<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[The 1-Bit Forum — Noise generator code]]></title>
		<link>http://randomflux.info/1bit/viewtopic.php?id=134</link>
		<atom:link href="https://randomflux.info/1bit/extern.php?action=feed&amp;tid=134&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Noise generator code.]]></description>
		<lastBuildDate>Fri, 30 Jun 2017 14:19:35 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Noise generator code]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=1360#p1360</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (utz)]]></author>
			<pubDate>Fri, 30 Jun 2017 14:19:35 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=1360#p1360</guid>
		</item>
		<item>
			<title><![CDATA[Noise generator code]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=1340#p1340</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (Shiru)]]></author>
			<pubDate>Tue, 20 Jun 2017 12:51:35 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=1340#p1340</guid>
		</item>
	</channel>
</rss>
