**References :** Posted by Paul Kellett

**Linked file** : pink.txt

(this linked file is included below)

**Notes :**

(see linked file)

**Comments**

__from__ : Tomy[AT]tomy-pa[DOT]de

__comment__ : Hi, first of all thanks a lot for this parameters.
I'm new to digital fitering, and need a 3dB highpass to correct a pink spectrum which is used for measurement back to white for displaying the impulseresponse.
I checked some pages, but all demand a fixed ratio between d0 and d1 for a 6db lowpass. But this ratio is not given on your filters, so I'm not able to transform them into highpasses.
Any hints?
Tomy

__from__ : Tomy[AT]tomy-pa[DOT]de

__comment__ : Hi, first of all thanks a lot for this parameters. I'm new to digital fitering, and need a 3dB highpass to correct a pink spectrum which is used for measurement back to white for displaying the impulseresponse.I checked some pages, but all demand a fixed ratio between d0 and d1 for a 6db lowpass. But this ratio is not given on your filters, so I'm not able to transform them into highpasses.Any hints?Tomy

__from__ : Christian[AT]savioursofsoul[DOT]de

__comment__ : If computing power doesn't matter, than you may want do design the pink noise in the frequency domain and transform it backt to timedomain via fft.
Christian

__from__ : haddadmajed[AT]yahoo[DOT]fr

__comment__ : HI, could you please give me a code matlab to have a pink noise. I
tested a code where one did all into frequential mode then made an ifft.
Thank you

__from__ : neolit123[AT]gmail[DOT]com

__comment__ : Here is a slightly less efficient implementation, which can be used to calculate coefficients for different samplerates (in ranges).
Note: You may also want to check the sample-and-hold method.
//trc - test rate coeff, srate - samplerate
trc = 1;
sr = srate*trc;
//f0-f6 - freq array in hz
//
//---------------------
//samplerate <= 48100hz
f0 = 4752.456;
f1 = 4030.961;
f2 = 2784.711;
f3 = 1538.461;
f4 = 357.681;
f5 = 70;
f6 = 30;
//---------------------
//samplerate > 44800hz && samplerate <= 96000hz
f0 = 8227.219;
f1 = 8227.219;
f2 = 6388.570;
f3 = 3302.754;
f4 = 479.412;
f5 = 151.070;
f6 = 54.264;
//---------------------
//samplerate > 96000khz && samplerate < 192000khz
f0 = 9211.912;
f1 = 8621.096;
f2 = 8555.228;
f3 = 8292.754;
f4 = 518.334;
f5 = 163.712;
f6 = 240.241;
//---------------------
//samplerate >= 192000hz
f0 = 10000;
f1 = 10000;
f2 = 10000;
f3 = 10000;
f4 = 544.948;
f5 = 142.088;
f6 = 211.616;
//----------------------
//calculate coefficients
k0 = exp(-2*$pi*f0/sr);
k1 = exp(-2*$pi*f1/sr);
k2 = exp(-2*$pi*f2/sr);
k3 = exp(-2*$pi*f3/sr);
k4 = exp(-2*$pi*f4/sr);
k5 = exp(-2*$pi*f5/sr);
k6 = exp(-2*$pi*f6/sr);
--- sample loop ---
//white - noise input
b0 = k0*white+k0*b0;
b1 = k1*white+k1*b1;
b2 = k2*white+k2*b2;
b3 = k3*white+k3*b3;
b4 = k4*white+k4*b4;
b5 = k5*white+k5*b5;
b6 = k6*white+k6*b6;
pink = (b0+b1+b2+b3+b4+b5+white-b6);
output = pink;
--- sample loop ---
Basically if you use the same coefficients, if comparing some outputs, you would notice a degradation in the filter at higher sample rates - Thus the different ranges. But the quality of your white noise (PRNG) may be important also.
These 'should' work...They do fairly well, at least mathematically for rendered outputs.
Lubomir

**Linked files**

Filter to make pink noise from white (updated March 2000)
------------------------------------
This is an approximation to a -10dB/decade filter using a weighted sum
of first order filters. It is accurate to within +/-0.05dB above 9.2Hz
(44100Hz sampling rate). Unity gain is at Nyquist, but can be adjusted
by scaling the numbers at the end of each line.
If 'white' consists of uniform random numbers, such as those generated
by the rand() function, 'pink' will have an almost gaussian level
distribution.
b0 = 0.99886 * b0 + white * 0.0555179;
b1 = 0.99332 * b1 + white * 0.0750759;
b2 = 0.96900 * b2 + white * 0.1538520;
b3 = 0.86650 * b3 + white * 0.3104856;
b4 = 0.55000 * b4 + white * 0.5329522;
b5 = -0.7616 * b5 - white * 0.0168980;
pink = b0 + b1 + b2 + b3 + b4 + b5 + b6 + white * 0.5362;
b6 = white * 0.115926;
An 'economy' version with accuracy of +/-0.5dB is also available.
b0 = 0.99765 * b0 + white * 0.0990460;
b1 = 0.96300 * b1 + white * 0.2965164;
b2 = 0.57000 * b2 + white * 1.0526913;
pink = b0 + b1 + b2 + white * 0.1848;
---
paul.kellett@maxim.abel.co.uk
http://www.abel.co.uk/~maxim/