I'm trying to generate pink noise from a bunch of 8 bit random numbers, and I came across this: b0 = 0.99765 * b0 + white * 0.0990460; b1 = 0.96300 * b1 + white * 0.2965164; b2 = 0.57000 * b2 + white * 1.0526913; tmp = b0 + b1 + b2 + white * 0.1848; from http://www.firstpr.com.au/dsp/pink-noise/#Filtering Is this some kind of special code that runs it matlab, where b0, b1, b2 etc.. are arguments for some special routine? Or can I create pink noise using this simple algorithm and my hand calculator, updating "white" every calculation with a new random number from my big pile of random numbers? If so, how does this work? It does not appear recursive. How can it take a white sample and pop out a pink sample without knowing anything about the past or future? What are b0, b1, and b2, if not just arbitrary variable names?
is this pinking filter literal?
Started by ●May 23, 2006
Reply by ●May 24, 20062006-05-24
acannell@wwc.com wrote:> I'm trying to generate pink noise from a bunch of 8 bit random numbers, > and I came across this: > > b0 = 0.99765 * b0 + white * 0.0990460; > b1 = 0.96300 * b1 + white * 0.2965164; > b2 = 0.57000 * b2 + white * 1.0526913; > tmp = b0 + b1 + b2 + white * 0.1848; > > > from http://www.firstpr.com.au/dsp/pink-noise/#Filtering > > > Is this some kind of special code that runs it matlab, where b0, b1, b2 > etc.. are arguments for some special routine?It looks like C to me. b0, b1, and b2 are recycled as each white noise sample passes through the filter. This code would probably be part of a for loop, with b0, b1 and b2 zeroed just before entering the loop. > Or can I create pink> noise using this simple algorithm and my hand calculator, updating > "white" every calculation with a new random number from my big pile of > random numbers?Perform the above calculation recursively, and you can generate pink noise by carving on stone tablets for all I care. :-)> If so, how does this work? It does not appear recursive. How can it > take a white sample and pop out a pink sample without knowing anything > about the past or future?Why would it want to know about the future? It does know about the past, because b0, b1 and b2 are used recursively.> > What are b0, b1, and b2, if not just arbitrary variable names?All variable names are arbitrary, aren't they? Steve
Reply by ●May 24, 20062006-05-24
in article 1148433642.544305.53120@y43g2000cwc.googlegroups.com, acannell@wwc.com at acannell@wwc.com wrote on 05/23/2006 21:20:> I'm trying to generate pink noise from a bunch of 8 bit random numbers, > and I came across this: > > b0 = 0.99765 * b0 + white * 0.0990460; > b1 = 0.96300 * b1 + white * 0.2965164; > b2 = 0.57000 * b2 + white * 1.0526913; > tmp = b0 + b1 + b2 + white * 0.1848; >...> > If so, how does this work? It does not appear recursive.sure it is recursive " b0 = 0.99765 * b0 + white * 0.0990460; " means to take the last value of b0, multiply by 0.99765, add "white*0.0990460" to it and that becomes the next (or current) value of b0.> What are b0, b1, and b2, if not just arbitrary variable names?they are states of the filter. since there are 3 states, it is a 3rd order system. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●May 24, 20062006-05-24
acannell@wwc.com wrote:> I'm trying to generate pink noise from a bunch of 8 bit random numbers, > and I came across this: > > b0 = 0.99765 * b0 + white * 0.0990460; > b1 = 0.96300 * b1 + white * 0.2965164; > b2 = 0.57000 * b2 + white * 1.0526913; > tmp = b0 + b1 + b2 + white * 0.1848; > > > from http://www.firstpr.com.au/dsp/pink-noise/#Filtering > > > Is this some kind of special code that runs it matlab, where b0, b1, b2 > etc.. are arguments for some special routine? Or can I create pink > noise using this simple algorithm and my hand calculator, updating > "white" every calculation with a new random number from my big pile of > random numbers? > > If so, how does this work? It does not appear recursive. How can it > take a white sample and pop out a pink sample without knowing anything > about the past or future?Looks like a parallel sum of three first order lowpass filters and a direct input. The lowpass filters have transfer function H_B(z) = 1 / (1- B z^-1). For the first filter in your list (b0), the constant is B=0.99765. "white" is the input to the whole structure, which I assume from the name is a white noise sequence. In that case, "tmp" is the output. The structure has transfer function H(z) = 0.0990460 H_B0(z) + 0.2965164 H_B1(z) + 1.0526913 H_B2(z) + 0.1848. Regards, Andor
Reply by ●May 24, 20062006-05-24