[sdiy] Pseudo Random Noise Generator in an AVR?
Naoki Iwakami
naoki.iwakami at gmail.com
Wed Jan 9 15:37:31 CET 2013
Hi Jim,
I did it using Arduino before. I used Linear Feedbak Shift Register.
http://en.wikipedia.org/wiki/Linear_feedback_shift_register
The source is available in Ongaku.h in following zip file, but it
might not be very useful since the source requires a shield I
developed.
http://gaje.jp/resources/ongakushield/OngakuShield_20100514.zip
In short, the algorithm is like following,
volatile uint16_t lfsr = 37892;
run_this_periodically() {
uint8_t m = (lfsr >> 12) & 0x1;
uint8_t n = (lfsr >> 15) & 0x1;
lfsr <<= 1;
lfsr |= m ^ n;
output_to_port(n); // n is 0 or 1. Set some output port
when n==1 and reset if n==0
}
I used timer overflow interruption to invoke the update cycle.
The noise quality would be good with high update rate, but I don't
remember the number, sorry (maybe around 10kHz?)
Lowering the clock is also interesting. That gives flanger-like effect.
ATTiny is good enough since the algorithm is very simple.
Cheers,
-- Naoki
On Tue, Jan 8, 2013 at 9:10 PM, Jim Patchell <patchell at cox.net> wrote:
> I am trying to elimnate parts in my current project. I have every thing on
> the board, except the analog noise generator (you know, reversed biased e-b
> junction. Gaining enough realestate may not be possible, and I don't want
> to add any more square inches. So, I was thinking, why not move the noise
> generator into the ATmega that is also on the board. Making a 32 bit linear
> feedback shift register in the firmware should not be a problem. Running it
> fast enough might be I would want to run it at a minimum of 40K shifts per
> second. Not even sure if that is fast enough.
>
> Anybody else every try something like this, and how did it work. Otherwise,
> I am going to have to break out the old STK500/501 and write some code. ;^)
>
> -Jim
>
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
--
岩上直樹
Naoki Iwakami
More information about the Synth-diy
mailing list