<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[The 1-Bit Forum — Noise generator code]]></title>
	<link rel="self" href="https://randomflux.info/1bit/extern.php?action=feed&amp;tid=134&amp;type=atom" />
	<updated>2017-06-30T14:19:35Z</updated>
	<generator>PunBB</generator>
	<id>http://randomflux.info/1bit/viewtopic.php?id=134</id>
		<entry>
			<title type="html"><![CDATA[Re: Noise generator code]]></title>
			<link rel="alternate" href="http://randomflux.info/1bit/viewtopic.php?pid=1360#p1360" />
			<content type="html"><![CDATA[<p>Excellent. I think noise is another underexplored area in beeper music, we definately can do more with it.<br />Btw I have an algo that produces similar quality as the above, but doesn&#039;t need DE. I&#039;m using this for the click drums in my recent engines.<br /></p><div class="codebox"><pre><code>     add hl,hl    ;11
     sbc a,a      ;4
     xor l        ;4
     ld l,a       ;4</code></pre></div><p>Then afterwards, the usual cp with duty threshold. Some suitable seeds are 1, #1011, and #1237. </p><p>I also tried to do it with just 8-bit operations.<br /></p><div class="codebox"><pre><code>     ld a,d
     add a,e
     rlca
     ld d,a
     rr e</code></pre></div><p>Seed DE with #21. Results are ok-ish, but not great. So I abandoned this idea for now.</p>]]></content>
			<author>
				<name><![CDATA[utz]]></name>
				<uri>http://randomflux.info/1bit/profile.php?id=2</uri>
			</author>
			<updated>2017-06-30T14:19:35Z</updated>
			<id>http://randomflux.info/1bit/viewtopic.php?pid=1360#p1360</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Noise generator code]]></title>
			<link rel="alternate" href="http://randomflux.info/1bit/viewtopic.php?pid=1340#p1340" />
			<content type="html"><![CDATA[<p>Just in case anyone will need it, came up with a kind of universal noise routine. It is strongly based on utz&#039;s noise generator with rlc h. Allows to control pitch, volume, and duration of a noise burst.</p><div class="codebox"><pre><code>    ld hl,0                ;noise accumulator
    ld de,#2174            ;utz&#039;s rand seed
    ld bc,#0101            ;noise pitch, #01 highest, #ff (#00 actually) lowest
    exx
    ld bc,1000            ;noise duration

noise_loop

    exx                    ;4
    dec c                ;4
    jr nz,noise_skip    ;7/12
    ld c,b                ;4
    add hl,de            ;11
    rlc h                ;8        utz&#039;s noise generator idea
    inc d                ;4        improves randomness
    jp noise_next        ;10
    
noise_skip

    jr $+2                ;12
    jr $+2                ;12
    nop                    ;4
    nop                    ;4
    
noise_next

    ld a,h                ;4
    
noise_volume=$+1
    cp #80                ;7    noise &#039;volume&#039; here, #80 max, less is lower volume
    
    sbc a,a                ;4
    out (#fe),a            ;11
    exx                    ;4

    dec bc                ;6
    ld a,b                ;4
    or c                ;4
    jp nz, noise_loop    ;10=106t</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Shiru]]></name>
				<uri>http://randomflux.info/1bit/profile.php?id=11</uri>
			</author>
			<updated>2017-06-20T12:51:35Z</updated>
			<id>http://randomflux.info/1bit/viewtopic.php?pid=1340#p1340</id>
		</entry>
</feed>
