Csound Csound-dev Csound-tekno Search About

pink noise in cmask

Date1998-11-18 04:31
Frompete moss
Subjectpink noise in cmask
anyone use cmask?  will using the line generator give me pink noise?
should i use the default value of -1 or something different?  any hints?

thanks
pete

Date1998-11-19 14:47
FromRobin Whittle
SubjectRe: pink noise in cmask
I have been trying, off and on, for several years to find a clean way 
of generating pink noise (AKA 1/f noise) with DSP.  One approach is 
to filter white (equal energy per hertz) noise with a -3db/octave low 
pass filter to generate the pink noise (equal energy per octave, or 
energy is proportional to 1/f) - but where does one come across a 
wideband -3db/octave filter?  Rare as rocking-horse poop as far as I 
can see.

Another is to generate multiple random frequencies, at sample rates 
with one octave spacings and add them all together.  Each is a "white 
noise in its own octave (very loosely speaking).  Summing them 
together gives you even energy for each octave.  However it is better 
not to do a square-wave sample and hold for each component noise 
source, but to interpolate between one sample and the next - 
otherwise you get big spikes in the output.


You really need to specify some low frequency below which you are not
interested.  Otherwise, the lower you go, the more octaves you 
accumulate and the more energy you get!


If anyone has an elegant solution to this, I would be most impressed!

- Robin

Here are some postings I made on this subject to the Music DSP list 
in June/July:

(There's no normal web-archive, but join at:
 http://shoko.calarts.edu/~glmrboy/musicdsp/music-dsp.html )

======

To the Music DSP List (which I have been lurking on) and Wentian 
Li, who maintains the best known web site devoted to 1/f noise:

   http://linkage.rockefeller.edu/wli/1fnoise/

For several years I have been thinking about DSP methods for 
producing "pink" noise, AKA 1/f noise - noise where the power is 
evenly distributed per octave.

One approach is to filter white noise with a -3dB rolloff lowpass 
filter, but these seem to be about as hard to come by as half an 
electron.

I did a bit of a search today, and came up with one interesting 
lead.  I haven't coded this - so I I am just reporting what I 
found.

In the manual for the Common Lisp Music programming language, Bill 
Schottstaedt  writes about a method of 
generating a reasonable approximation to 1/f noise, by summing 
together multiple random number generators:

   http://ccrma-www.stanford.edu/CCRMA/Software/clm/clm-manual/clm.html#randh

   "Orfanidis also mentions a clever way to get reasonably good 1/f
   noise: sum together n randh's, where each randh is running an 
   octave slower than the preceding (one):" 


This is a reference to Sophocles Orfanidis' book "Introduction to 
Signal Processing":

   http://www.prenhall.com/books/esm_0132091720.html

This sounds like a pretty good way to do it.  


Here are two other things I found which might be of interest:

- - - -

A Dutch company sells logic designs for ICs, which implement 
certaion functions, including a 4000 gate, 0.1 k byte ROM random 
noise source and "pink noise" filter which produces impressively 
flat pink noise in the audio range.  This is a non-trivial 
exercise, it seems, because on the same page they mention an ADCPM 
codec for up to four channels and it only needs about 10% more 
resources.

   http://www.dedris.nl/mainic1.htm#Pink Noise

- - - - 

A mini-treatise on the various "colors of noise", including the
observation on filtering white noise to create pink noise:  "Many
point out that this is not a trivial filtering problem."

 http://ds.dial.pipex.com/msaxon/colors.htm


======

[ From robert bristow-johnson  ]

another method that Orfanidis mentions came from a comp.dsp post of mine.
it's just a simple "pinking" filter to be applied to white noise.  since
the rollof is -3 dB/octave, -6 dB/octave (1st order pole) is too steep and
0 dB/octave is too shallow.

an equiripple approximation to the ideal pinking filter can be realized by
alternating real poles with real zeros.  a simple 3rd order solution that i
obtained is:

	pole            zero
	----            ----
	0.99572754      0.98443604
	0.94790649      0.83392334
	0.53567505      0.07568359

the response follows the ideal -3 dB/octave curve to within + or - 0.3 dB
over a 10 octave range from 0.0009*nyquist to 0.9*nyquist.  probably if i
were to do it over again, i'd make it 5 poles and 4 zeros.


r b-j
pbjrbj@viconet.com   a.k.a.   robert@audioheads.com
                     a.k.a.   robert@wavemechanics.com

"Don't give in to the Dark Side.  Boycott intel and microsoft."

======




Thanks to Robert Bristow-Johnson  for the 
-3dB/Octave filter details.  

Although I have done some work with straightforward FIR filters, I 
think really need to read C Britton Rorabaught's 2nd Ed "Digital 
Filter Designers Handbook" (and learn more about the mathematics 
that underlies much DSP) before I know how to implement such a 
filter.

The idea of interpolating the lower octave noise sources rather 
than straight "sample and hold" seems like a good approach to 
reducing the glitches when several octave cycles are together.

Thanks Allan Herriman  for the 
Xilinx app note reference with the LFSR taps.  There must be some 
arcane theory for the longer ones, since they can't possibly have 
been tested in this universe.







===============================================================

Robin Whittle     rw@firstpr.com.au  http://www.firstpr.com.au
                  Heidelberg Heights, Melbourne, Australia 

First Principles  Research and expression: music, Internet 
                  music marketing, telecommunications, human 
                  factors in technology adoption. Consumer 
                  advocacy in telecommunications, especially 
                  privacy. Consulting and technical writing. 

Real World        Electronics and software for music: eg.
Interfaces        the Devil Fish mods for the TB-303.