# Code for generating 1/f^alpha pink noise

Started by October 13, 2008
On 15 Okt., 18:16, Sampo Niskanen <spnis...@cc.hut.fi> wrote:
> Andor <andor.bari...@gmail.com> wrote: > > This sounds a bit contradicting. Either you are intersted in 1/f^{5/3} > > noise, or you are worried about values in the series deviating from > > zero for long periods. > > You can't have both. > > The application in my case was simulating wind turbulence. &#2013266080;Wind > turbulence freqency has a power spectrum density proportional to > 1/(1+K*f)^(5/3), which for large f is equal to 1/f^(5/3). &#2013266080;The > simulation time scale, however, is quite short, so I don't want a gust > of wind to last the whole simulation duration (that would effectively > change the average wind speed). > > By choosing the number of poles suitably one can choose how much low > frequency components to include. &#2013266080;The original (empirical) formula > doesn't go to infinity at f=0 either, so one could estimate it with a > suitable number of poles. &#2013266080;In my case I wanted even less low-frequency > components, and using 2 poles with a 20Hz sampling rate yields maximum > wind gust lengths of approximately 3-5 seconds (the spectrum turns flat > below 0.3Hz). &#2013266080;So in my application, it is desireable that the noise is > pink at the high end of the spectrum, but flat at the low end.
Ok, I see. I think I had a similar discussion with somebody here some time ago who wanted to use "pink noise" for audio testing purposes. He was also interested in generating series with PSD proportional to 1/(1+ K f), with a finite cutoff, going flat towards DC, and having the 1/f property for audible frequencies. Perhaps it would be a suitable nomenclature to call that kind (with finite cutoff frequency towards DC) of series "pink noise", as compared to 1/f^alpha noise. By definition, 1/f^alpha noise has a PSD satisfying lim_{f->0} ( P(f) / [c |f|^{-alpha}] ) = 1 for some constant c, so only the behaviour towards DC is important (as opposed to "pink noise", where only the behaviour towards infinity is important). Regards, Andor
Andor <andor.bariska@gmail.com> wrote:
> Ok, I see. I think I had a similar discussion with somebody here some > time ago who wanted to use "pink noise" for audio testing purposes. He > was also interested in generating series with PSD proportional to
> 1/(1+ K f),
> with a finite cutoff, going flat towards DC, and having the 1/f > property for audible frequencies. Perhaps it would be a suitable > nomenclature to call that kind (with finite cutoff frequency towards > DC) of series "pink noise", as compared to 1/f^alpha noise.
That's true. However, as seen on the DSP generation of Pink Noise web site[1] "pink noise" typically refers simply to noise with PSD proportional to 1/f instead of 1/f^alpha. Therefore some distinction must be made between these two. (Of course the correct way would be to always talk about 1/f^alpha, with alpha=1 being a special case, but this is currently uncommon.) In any case, my code allows the limiting frequency to be made arbitrarily low (though of course this slows down the generation a bit, as generating a sample is O(n) for the number of poles). [1] http://www.firstpr.com.au/dsp/pink-noise/ -- __________________________________________________ /____\ Sampo Niskanen <=> sampo.niskanen@iki.fi \ \ http://www.iki.fi/sampo.niskanen/ \ \ ________________________________________\___ \___/___________________________________________/
Andor wrote:
> On 15 Okt., 18:16, Sampo Niskanen <spnis...@cc.hut.fi> wrote:
>> The simulation time scale, however, is quite short, so I don't >> want a gust of wind to last the whole simulation duration (that >> would effectively change the average wind speed).
> Ok, I see. I think I had a similar discussion with somebody here > some time ago who wanted to use "pink noise" for audio testing > purposes. He was also interested in generating series with PSD > proportional to > > 1/(1+ K f), > > with a finite cutoff, going flat towards DC, and having the 1/f > property for audible frequencies.
Another situation where a low-frequency cutoff would be desirable is when the generating mechanism is intermittency. Some nonlinear systems have an operating regime where the state grows very slowly, until it crosses a threshold inducing bursty output, which eventually returns the state to the slow region. If the duration of quiescent intermissions is unbounded then the system can exhibit true low- frequency divergence. Now, feeding the intermittent signal to an allpass filter can turn bursts into smoother oscillation suitable for modulating musical quantities, like pitch. But we don't want that viola synth to sound like an '80s Casio every now and then, so the intermission length must not much exceed the effective length of the allpass impulse response in this application. I don't know if anyone has published on this in the musical context, but here are two articles describing intermittent iteration processes, one free and one not: http://www.istia.univ-angers.fr/~chapeau/papers/psiplrc2.pdf http://prola.aps.org/abstract/PRA/v31/i3/p1830_1 Martin -- When he had finally achieved a position that allowed him to say everything he thought, he only thought of his position anymore. --Gabriel Laub