22.6us and ~10mips to create pink noise real time

Okay I've got an Atmel AVR ATTiny13V. Runs off 3V, 100ns instruction time. I am trying to generate 8 bit pink noise real time, cd quality, so I have 1/44100 = 22.6us to generate each sample. I can write it in assembler, or C, but I only have 1k of program memory so assembler is probably the way to go here. Where should I start? Is it possible to make a -3db/octave digital filter in assembler which takes random 8 bit numbers and spits out pink noise?

Reply to
acannell
Loading thread data ...

You could take this and modify it

formatting link

Dirk

Reply to
Dirk Bruere

formatting link

Dirk

Reply to
Dirk Bruere

BTW, I did this experiment (burned a cd, though, instead of making a signal generator). All I learned was that the frequency response of my stereo was pitiful along axes I had no control over without spending a lot of $$$. Good luck! :)

--
Ben Jackson

http://www.ben.com/
Reply to
Ben Jackson

For true "CD quality" you need a 16-bit sample.

At about 200 instructions per sample, 8-bit math and no hardware multiply-accumulate function, I doubt you could do the filter. If you use a DSPic or one of the MSP430's that has the MAC add-on, you MAY be able to do an appropriate FFT filter in real time. I think I would go for one of the inexpensive but 'real' DSP's from TI or Moto, er, Freescale. With these you can do 'true 16bit' and at least get 12-bit resolution, or even do fixed-point "double precision"

32-bit and get better than 16-bit performance, easily done at the CD sample rate.
Reply to
Ben Bradley

Jeepers, in the old days we used these things called "analog" parts. One zener diode, one resistor, one capacitor, one LM714, viola, noise source. Nt a lick of programming and no problem looping the noise, as it's all freshly made every microsecond.

Reply to
Ancient_Hacker

Generate white noise in s/w using pseudorandom numbers and filter it using analogue? In which case er... why not use all analogue.

Dirk

Reply to
Dirk Bruere

We did use all analog-- the zener (or a transistor E-B junction reverse biased) generates the noise. 7 cents, no programming, and very low power consumption.

Reply to
Ancient_Hacker

"Ancient_Hacker" a écrit dans le message de news: snipped-for-privacy@j55g2000cwa.googlegroups.com...

But you'll need more than a simple RC filter to mimic 3dB/octave. First order filters give 6dB/o

--
Thanks,
Fred.
Reply to
Fred Bartoli

I would think this is a good way to do it, but what about temperature and part-to-part variances in spectrum of the noise? I cant tweak this circuit at all, its got to roll off the assembly line ready to go. And making the circuit from scratch is beyond my abilities, I'm just not that good dealing with the junctions resistance and all the little details which this kind of circuit would be extra sensitive to.

Reply to
acannell

The only simple way I can think of doing is is digitising some pink noise and replaying it. How much data memory do you have?

Dirk

Reply to
Dirk Bruere

The filter can be passive but it needs about as many parts as the number of octaves.

--
--
kensmith@rahul.net   forging knowledge
Reply to
Ken Smith

wrote:

Somehow, I remember seeing filters that convert white noise to noise that is pink within +/- less than 1 dB throughout the audio spectrum with a bit fewer parts than that... Then again I could have found to be "conveniently simple" a filter circuit with a few resistors and capacitors totalling could have been about as many 10 parts although I thought a bit less than that.

But it is true - converting white noise to pink noise requires a 3 dB/octave slope which for entyire audio spectrum requires several of what I think of as "shelf filters" - flat frequency response at very high and very low frequencies but gain varying inversely with frequency over some range. I have seen impressive "pink noise filter circuits" with three "shelf filter" stages, and somehow I suspect that could use fewer than 10 parts...

Now I try Google and get:

formatting link

A couple filters, one with 8 parts, and a couple spectral analysis plots with the one from the 8-part circuit being pink noise +/- not much more than .2 dB from 10 Hz to 29 KHz if I did not do any misinterpretations.

formatting link

A more complete pink noise generator circuit, with the filtering achieved by 9 parts and looking good (within a dB) for 10 Hz to 20 KHz and loking like well within half a dB of a straight line throughout most of the audio spectrum.

formatting link

A kit, although I did not see a statement of how closely it approximates pink noise nor a circuit showing the number of parts in the filter. But it does appear to be a simple enough kit!

formatting link

Similar kit, possible the same one.

formatting link

An "audio spectrum analyzer pink noise generator" circuit - where I see

9 parts that I see being filter components.

formatting link

Another circuit with white and pink noise outputs, with the filter section appearing to me to have 9 parts.

- Don Klipstein ( snipped-for-privacy@misty.com)

Reply to
Don Klipstein

oops, I didnt catch the fact that you want to make many of these, and to tight tolerances. Exactly what are the design specs?

For pink noise, you will need a few more r-c sections, see:

formatting link

And the noise from the diode or B-E junction will vary a bit from sample to sample. But at 7 cents a transistor, you can maybe afford to do a 2-second test for each xistor and toss the weakest 33% of them? Or use them for the output amp if the op-amp doesnt have enough oomph to drive the headphones?

And if you're driving headphones, you probably don't need a very precise 3db/octave filter. Your average headphones are anything but flat, especially the popular ear-bud kind.

Reply to
Ancient_Hacker

Depending on the accuracy you want in the spectral content of the "pink" noise, to do it digitally you'll need a random generator (white noise) and "a few" stages of IIR biquads. You could use single-pole filter stages, but as I recall when I did it years ago, I decided the biquads were computationally slightly more efficient. (You may even find my name on a set of pink filter pole and zero locations that's still floating around in cyberspace. Every once in a while someone writes to ask me about them.) Some of the poles are at a very tiny fraction of the sample frequency, so have to be done with high precision math for good results. I _seriously_ doubt you'll do it in your Atmel at a couple hundred instructions per sample. In a DSP with hw MAC you should be able to do a good job in a hundred instructions, plus or minus--even fifty instructions would let you do a few poles & zeros.

But...If you don't need super-accurate "pinkness" you could easily generate a pseudorandom bitstream in the atmel (excellent and repeatable "whiteness" and high amplitude, and ample bandwidth if that's all the AVR is doing) and filter that with a few RC stages. You can get 1% caps (C0G ceramics) and 1% or better resistors, which may very well provide adequate or even ample accuracy and stability for your purposes. The board area and placement cost will cost more than the parts you put on it, most likely.

Cheers, Tom

Reply to
Tom Bruhns

'scuse me, the title says "create pink noise real time".. and I know what the author meant, but ,,

if I have a box which makes pinks noise, and i dont know what is inside the box... but I turn on the power and out comes a pink noise signal. .. then to any observer, is the pink noise "real time" or not?

If I play back a recording of pink noise, is it measurably less pink than than one created by a computational algorithm (in real time) ?

Just in terms of terminology, if I can compute 'real time' a very good pink noise signal, it's equisite randomness will be conveniently in relation to some clock in some extended context (real time).. it's very randomness make the relation to such 'some clock' useless.. so how could a 'truly' random signal be 'real time' in any meaningful way?

I take it the author probably meant 'when you press a key within a milisecond or so, start such and such' ... but I thought it would be useful for some to consider the juxtaposition of terms and why.

But to approximate pink noise real time.. I would consider approximating white noise, possibly by some clever indexing of randomized lists of primes which in turn index other lists of primes, and apply some kind of filtering to make it pink... claiming a marginally better randomness than other simple methods.

Of course this is trivial for many who post here, but I put in my

2.948001384 cents on it for those who'd enjoy some less formal chatter on the subject.
Reply to
engineer

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.