Hello, I am currently writing software to generate 1/f, 1/f^2 and 1/f^3 noise for use in a simulation, using an existing Gaussian PRNG. Currently, I am generating 1/f noise with the Voss-McCartney algorithm (from here: http://www.firstpr.com.au/dsp/pink-noise/), and it seems to work extremely well and perform well enough for my application. I am generating the 1/f^2 noise (noise with a rolloff of 20dB per decade) by passing the output of my Gaussian noise source through a single pole integrator. The output of this process matches the target rolloff very nicely. Is this a generally accepted way to generate 1/f^2 noise? Does anybody know of a more elegant way to generate 1/f^3 (30dB per octave) noise than pass the output of my 1/f noise generator through an integrator? Regards Marc Brooker

# Generating 1/f^2 and 1/f^3 noise

Started by ●March 9, 2007

Reply by ●March 9, 20072007-03-09

On 9 Mrz., 09:42, Marc Brooker <myrealn...@gmail.com> wrote:> Hello, > > I am currently writing software to generate 1/f, 1/f^2 and 1/f^3 noise > for use in a simulation, using an existing Gaussian PRNG. Currently, I > am generating 1/f noise with the Voss-McCartney algorithm (from here:http://www.firstpr.com.au/dsp/pink-noise/), and it seems to work > extremely well and perform well enough for my application. > > I am generating the 1/f^2 noise (noise with a rolloff of 20dB per > decade) by passing the output of my Gaussian noise source through a > single pole integrator. The output of this process matches the target > rolloff very nicely. Is this a generally accepted way to generate 1/f^2 > noise? > > Does anybody know of a more elegant way to generate 1/f^3 (30dB per > octave) noise than pass the output of my 1/f noise generator through an > integrator? >I do it in a even more unelegant way (with a IDFT): I calculate the amplitude for whatever spectral distribution of the "noise" i want. For example: amplitude=1/f^1.1 I "randomize" the phase with "random" numbers, do a IDFT. For Audio sampled with 44100 Hz and a loop length of 131072 Samples it sounds quite like "noise". It's funny to listen to it for a while (with slightly changing room acoustics). Concentrating on this sound sometimes i seem to notice a certain "rythm" which is the 44100Hz/131072 ? I guess one could find out something about the audio perception with his brain.

Reply by ●March 9, 20072007-03-09

On Mar 9, 3:42 am, Marc Brooker <myrealn...@gmail.com> wrote:> I am currently writing software to generate 1/f, 1/f^2 and 1/f^3 noise > for use in a simulation, using an existing Gaussian PRNG.Gaussian is less important than it being white (with virtually no DC component to mess up your integrators).> Currently, I > am generating 1/f noise with the Voss-McCartney algorithm (from > here:http://www.firstpr.com.au/dsp/pink-noise/), and it seems to work > extremely well and perform well enough for my application.a pinking filter, i presume.> I am generating the 1/f^2 noise (noise with a rolloff of 20dB per > decade) by passing the output of my Gaussian noise source through a > single pole integrator. The output of this process matches the target > rolloff very nicely. Is this a generally accepted way to generate 1/f^2 > noise?if by "Gaussian" you mean "white" (this is a misnomer, "Gaussian" does not mean "white", the former describes the probability density function, the latter describes the power spectrum - not the same thing), that is a perfectly normal way to do it.> Does anybody know of a more elegant way to generate 1/f^3 (30dB per > octave)you mean -9 dB per octave, correct?> noise than pass the output of my 1/f noise generator through an > integrator?seems pretty straight-forward and elegant to me. what's wrong with it? r b-j

Reply by ●March 10, 20072007-03-10

robert bristow-johnson wrote:> On Mar 9, 3:42 am, Marc Brooker <myrealn...@gmail.com> wrote: > >> I am currently writing software to generate 1/f, 1/f^2 and 1/f^3 noise >> for use in a simulation, using an existing Gaussian PRNG. > > Gaussian is less important than it being white (with virtually no DC > component to mess up your integrators).The generator is both Gaussian and white. I should have made that clear from the beginning.> >> Currently, I >> am generating 1/f noise with the Voss-McCartney algorithm (from >> here:http://www.firstpr.com.au/dsp/pink-noise/), and it seems to work >> extremely well and perform well enough for my application. > > a pinking filter, i presume.Not really - it involves combining a row of white noise generators using zero-th order holds of various lengths. It's a clever algorithm, and works very well. It could be replaced with a single white noise source and a suitable pinking filter, however.> >> I am generating the 1/f^2 noise (noise with a rolloff of 20dB per >> decade) by passing the output of my Gaussian noise source through a >> single pole integrator. The output of this process matches the target >> rolloff very nicely. Is this a generally accepted way to generate 1/f^2 >> noise? > > if by "Gaussian" you mean "white" (this is a misnomer, "Gaussian" does > not mean "white", the former describes the probability density > function, the latter describes the power spectrum - not the same > thing), that is a perfectly normal way to do it.Again, yes - the noise source is both white (or very nearly, within 0.1dB) and Gaussian.> >> Does anybody know of a more elegant way to generate 1/f^3 (30dB per >> octave) > > you mean -9 dB per octave, correct?Yes -9dB per octave, or -30dB per decade.> >> noise than pass the output of my 1/f noise generator through an >> integrator? > > seems pretty straight-forward and elegant to me. what's wrong with > it?Thanks - that's what i needed - confirmation that what I am doing isn't completely clueless. There is not much literature available on the generation of noise with DSP techniques. As was pointed out earlier in this thread, it's easy enough to do it with the FFT, but I don't know before hand how many noise samples I am going to need, and might not have enough memory to store all my noise samples at the same time. Regards Marc

Reply by ●March 10, 20072007-03-10

On Mar 9, 3:42 am, Marc Brooker <myrealn...@gmail.com> wrote:> I am generating the 1/f^2 noise (noise with a rolloff of 20dB per > decade) by passing the output of my Gaussian noise source through a > single pole integrator. The output of this process matches the target > rolloff very nicely. Is this a generally accepted way to generate 1/f^2 > noise? > > Does anybody know of a more elegant way to generate 1/f^3 (30dB per > octave) noise than pass the output of my 1/f noise generator through an > integrator?We encountered a related problem recently where we had to generate noise with a Planck distribution for some thermal simulations. Essentially, the problem of generating correlated noise is simply one of filtering white noise with a filter H(f) with the desired correlation spectrum |H(f)|^2. The IDFT method mentioned earlier in this thread is just an FIR filter of the same length as the data, designed by a window method. Naturally, much shorter filters are more memory efficient, especially if you are generating your random sequence on the fly and don't want to store the whole thing at once. And IIR filters are more efficient than FIR filters for the same number of degrees of freedom, especially since filter phase is irrelevant...most of the algorithms discussed above, e.g. integrators, can be viewed in this class. For certain noise spectra, e.g. Lorentzian (exponentially decaying correllations), an exact IIR filter can be designed analytically. For others, you have to design your filter numerically. However, since it is a magnitude-only filter-design problem, there are some algorithms published by Rabiner et al. in 1974 to find a global Chebyshev optimum minimum-phase stable IIR filter quickly via a sequence of linear- programming problems. Steven

Reply by ●March 11, 20072007-03-11

On 9 Mar 2007 03:30:46 -0800, ray@desinformation.de wrote:>On 9 Mrz., 09:42, Marc Brooker <myrealn...@gmail.com> wrote: >> Hello, >> >> I am currently writing software to generate 1/f, 1/f^2 and 1/f^3 noise >> for use in a simulation, using an existing Gaussian PRNG. Currently, I >> am generating 1/f noise with the Voss-McCartney algorithm (from here:http://www.firstpr.com.au/dsp/pink-noise/), and it seems to work >> extremely well and perform well enough for my application. >> >> I am generating the 1/f^2 noise (noise with a rolloff of 20dB per >> decade) by passing the output of my Gaussian noise source through a >> single pole integrator. The output of this process matches the target >> rolloff very nicely. Is this a generally accepted way to generate 1/f^2 >> noise? >> >> Does anybody know of a more elegant way to generate 1/f^3 (30dB per >> octave) noise than pass the output of my 1/f noise generator through an >> integrator? >> > >I do it in a even more unelegant way (with a IDFT): > >I calculate the amplitude for whatever spectral distribution of the >"noise" i want. > >For example: amplitude=1/f^1.1 > >I "randomize" the phase with "random" numbers, do a IDFT. For Audio >sampled with 44100 Hz and a loop length of 131072 Samples it sounds >quite like "noise". > >It's funny to listen to it for a while (with slightly changing room >acoustics). >Concentrating on this sound sometimes i seem to notice a certain >"rythm" which is the 44100Hz/131072 ? >I guess one could find out something about the audio perception with >his brain.That's a period of 2.97 seconds, which is apparently within the time of "perception" of a repeated random signal. The ear/brain can definitely, even easily hear a repeated section of noise (of most any spectrum, I presume) of a second or less. It sounds like a tape loop of a noise recording, because that's exactly what it is. How the ear/brain detects this is probably Master's thesis material.

Reply by ●March 12, 20072007-03-12

Marc Brooker wrote:> Hello, > > I am currently writing software to generate 1/f, 1/f^2 and 1/f^3 noise > for use in a simulation, using an existing Gaussian PRNG. Currently, I > am generating 1/f noise with the Voss-McCartney algorithm (from here: > http://www.firstpr.com.au/dsp/pink-noise/), and it seems to work > extremely well and perform well enough for my application. > > I am generating the 1/f^2 noise (noise with a rolloff of 20dB per > decade) by passing the output of my Gaussian noise source through a > single pole integrator. The output of this process matches the target > rolloff very nicely. Is this a generally accepted way to generate 1/f^2 > noise? > > Does anybody know of a more elegant way to generate 1/f^3 (30dB per > octave) noise than pass the output of my 1/f noise generator through an > integrator?Rather the opposite: my method[1] is to generate white noise using a random generator, do an FT, weight the flat spectrum with the desired curve and do an IFT to get the weighted noise. A rather unelegant and time consuming approach, but very flexible since you can apply any curve. [1] http://www.huennebeck-online.de/software/download/src/index.html (gensig) bye Andreas -- Andreas H�nnebeck | email: acmh@gmx.de ----- privat ---- | www : http://www.huennebeck-online.de Fax/Anrufbeantworter: 0721/151-284301 GPG-Key: http://www.huennebeck-online.de/public_keys/andreas.asc PGP-Key: http://www.huennebeck-online.de/public_keys/pgp_andreas.asc

Reply by ●March 12, 20072007-03-12

On Mar 12, 2:33 am, Andreas Huennebeck <a...@gmx.de> wrote:> Rather the opposite: my method[1] is to generate white noise using a random > generator, do an FT, weight the flat spectrum with the desired curve and > do an IFT to get the weighted noise. A rather unelegant and time consuming > approach, but very flexible since you can apply any curve.As I mentioned, this (well-known) method is equivalent to an FIR filter of the same length as the data, designed by the window method. As you say, it works for any desired noise spectrum. The main drawback is that you need to store the entire random sequence, which is problematic if you are generating very long sequences, or many sequences in parallel, or don't know the required length in advance. The generalization of this approach is to apply an FIR or IIR filter of any desired length (shorter = less storage), designed by whatever method is most convenient, and it turns out that there exist IIR filter-design techniques that give you a guaranteed global Cheybyshev optimum solution for this problem with any given filter order and for any arbitrary noise spectrum. Steven

Reply by ●March 13, 20072007-03-13

Steven wrote: ...> For certain noise spectra, e.g. Lorentzian (exponentially decaying > correllations), an exact IIR filter can be designed analytically. For > others, you have to design your filter numerically. However, since it > is a magnitude-only filter-design problem, there are some algorithms > published by Rabiner et al. in 1974 to find a global Chebyshev optimum > minimum-phase stable IIR filter quickly via a sequence of linear- > programming problems.Interesting. Do you have a reference for this filter design method? Regards, Andor

Reply by ●March 13, 20072007-03-13

On Mar 13, 2:55 am, "Andor" <andor.bari...@gmail.com> wrote:> > For certain noise spectra, e.g. Lorentzian (exponentially decaying > > correllations), an exact IIR filter can be designed analytically. For > > others, you have to design your filter numerically. However, since it > > is a magnitude-only filter-design problem, there are some algorithms > > published by Rabiner et al. in 1974 to find a global Chebyshev optimum > > minimum-phase stable IIR filter quickly via a sequence of linear- > > programming problems. > > Interesting. Do you have a reference for this filter design method?There are actually several related methods for the magnitude-only IIR design problem. One of my graduate students recently submitted a short paper summarizing the published methods for generating correlated random sequences ("colored noise"), citing the various references on the IIR design problem and explaining their applicability to the colored-noise problem, since they do not seem to be widely known in this context. I've posted a preprint at: http://math.mit.edu/~stevenj/preprints/iir-colored-noise-2007-03-13.pdf Regards, Steven G. Johnson