Sign in

username or email:

password:



Not a member?
Forgot your password?

Search compdsp



Search tips


Discussion Groups

Free Online Books

See Also

Embedded SystemsFPGA

Discussion Groups | Comp.DSP | is this pinking filter literal?

There are 5 messages in this thread.

You are currently looking at messages 1 to .


Is this discussion worth a thumbs up?

0

is this pinking filter literal? - 2006-05-23 21:20:00

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?

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: is this pinking filter literal? - Steve Underwood - 2006-05-23 23:00:00



a...@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

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: is this pinking filter literal? - robert bristow-johnson - 2006-05-23 23:11:00

in article 1...@y43g2000cwc.googlegroups.com,
a...@wwc.com at a...@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                  r...@audioimagination.com

"Imagination is more important than knowledge."


______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: is this pinking filter literal? - Andor - 2006-05-24 04:13:00

a...@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

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: is this pinking filter literal? - Martin Blume - 2006-05-24 13:49:00

"Steve Underwood" schrieb 
> 
> Why would it want to know about the future? 
>
This might be a handy feature at times :-)

SCNR
Martin


______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.