DSPRelated.com
Forums

Blue Noise creation via filtering?

Started by No Name July 25, 2004
Original poster here:

First of all let me thank everyone for the rapid and cogent replies,
many of which I might have a prayer of understanding after several
years of protracted study.  :-)

I'll better clarify my problem, which I should have done in the first
place, and then attempt to address some of your replies with
quasi-intelligent questions.

I'm trying to produce a sample of "blue noise" of arbitrary length
(say 1-10 minutes), in 16-bit signed 44.1KHz PCM.  A generic monaural
wave file, basically, the same format as CDDA.  That's all.  So of
course I can't get true blue noise, since my chunk of the spectrum
ends at ~22KHz.  And I don't need the process to be particularly
computationally efficient, as it's only going to happen once in order
to make a sample.  Finally, I don't need exacting conformance to an
ideal "blue noise" spectrum.  It should be close enough for government
work, so to speak, sort of like the output of Voss-McCartney is close
enough to pink noise for many.

My prime need in a solution is ease, because it's only going to happen
once -- preferably some sort of warm, fuzzy GUI or command-line
package I can use to process a WAV file on Windows or Linux, though if
there's some amazingly elegant solution and simple that I can easily
implement in x86 assembly language (or C) and tack onto the end of a
white noise generator, I'm all ears.  A close second priority would be
the quality of the sample produced.

I'm not a "DSP guy", as some other poster recently stated.  Much of
the technical language used so far is way beyond me, and although I
don't expect to be spoon-fed, I'm still pretty lost.  Let me see if I
can pick apart some of your initial responses and ask a few questions.

Andor Bariska writes:
>If I had to create noise with psd ~ f, I would filter white noise with >the differential operator, which has a frequency response of f. A >computationally extremely efficient approximation would be to use the >first difference operator with impulse response h = {1,-1}.
Mark Borgerding responds with something even more complicated ;-) and then ends up with:
>*shrug* > >I'd probably go with filtering white noise as OP suggested.
Andor replies:
>Yes, that's the whole point - the OP asked what kind of filter to use. I >suggested the first difference. If that isn't close enough, you can >generate a higher order FIR approximation of the differential operator, >but that usually is overkill.
Okay. I don't know what a differential operator is, nor the first difference operator. In fact, I'm kind of afraid to venture a wild guess, so I'll just ask, what is it? It sounds like Andor thinks this would produce a reasonable facsimile of blue noise, which is what I want. Can anyone suggest *holds breath* a free software package with which I might be able to apply this sort of a filter to a pre-existing (or generated) sample/stream of white noise? Bernhard Holzmayer writes:
>High-pass filter with the 3db-point at the maximum frequency where >your noise spectrum ends. The whole band is on the flange of the >filter - you don't use the passband region.
Wouldn't this make the entire spectrum into one octave? My musical knowledge is about as poor as my DSP knowledge, I'm afraid. Also, I'm only familiar with software (Goldwave) that allows one to define high/low pass filters in terms of Hz, not dB/octaves/whatever I need to be talking about. Any suggestions on software, preferably free/GPL/open source? Bernhard further writes:
>In the frequency domain, define your spectrum, then do an inverse >FFT, which will give you the desired noise.
I'm going to assume this might be more difficult than your first suggestion for the same result? I have a somewhat shaky conceptual understanding of a FFT, but rapidly gave up the idea of understanding the math behind them while implementing my pink noise generator. fumminger@umminger.com writes:
>If you can generate pink noise easily, just filter it with a 6 >dB/octave high pass filter (i.e. a differentiator) to get the blue >noise. There is plenty of literature on differentiators available >online, and you may be able to get by with just taking the difference >of successive samples.
This sounds similar to the suggestions offered above about filtering white noise. Now, based on an educated guess, wouldn't the result of filtering pink noise in this manner have very low amplitude, as most of the power in pink noise is at the low end, whereas most in blue noise is at the high end?
>Btw, the Voss-McCartney algorithm is a very inefficient way to >generate pink noise. You will do much better by applying a simple IIR >filter to a white noise stream. You can find the necessary filter >coefficients at the music-dsp source code archive >(http://www.musicdsp.org/).
You're probably right. However, the Voss-McCartney algorithm is easy to implement in assembly language for one's honors project. ;-) Though skimming musicdsp.org, that does look even easier on the surface. Oh well. Also, of course, I only need to generate the noise once, as I only need samples of it (pink or blue). One erratum: pink noise is described more accurately (I believe) as follows: "Since power is proportional to amplitude squared, the energy per Hz will decline at higher frequencies at the rate of about -3dB per octave. To be absolutely precise, the rolloff should be -10dB/decade, which is about 3.0102999 dB/octave." Source: http://www.firstpr.com.au/dsp/pink-noise/ I don't know what a decade is, but perhaps it makes a difference to some of you to describe it like that.
On Mon, 26 Jul 2004 16:01:45 +0200, Andor Bariska <an2or@nospam.net>
wrote:

>Correction: >|H(w)| = |1 - Exp(-j w)| = 2 Sin(w/2)
I just posted a big long thing and left this out of it, but what are H, w, and j in this function? :-x
an2or@mailcircuit.com (Andor) writes:
> [...] > If I had to create noise with psd ~ f, I would filter white noise with > the differential operator, which has a frequency response of f. A > computationally extremely efficient approximation would be to use the > first difference operator with impulse response h = {1,-1}.
Wasn't there a song written about this? "Don't it make your brownian motion blue?" ...? -- Randy Yates Sony Ericsson Mobile Communications Research Triangle Park, NC, USA randy.yates@sonyericsson.com, 919-472-1124
No Name wrote:

> On Mon, 26 Jul 2004 16:01:45 +0200, Andor Bariska <an2or@nospam.net> > wrote: > > >>Correction: >>|H(w)| = |1 - Exp(-j w)| = 2 Sin(w/2) > > > I just posted a big long thing and left this out of it, but what are > H, w, and j in this function? :-x
'w' is by convention, the way lower-case omega ia approximated with a computer keyboard. It is the symbol used to represent frequency measured in radians per second. Not all computers properly render '?'. 'j' is the symbol that engineers use to represent the square root of -1. Physicists and mathematicians use 'i'. H(w) is read "H of omega" and is short for "H, a function of omega". H is a nondimensional function whose dependent variable is ?. I don't see the "big long thing" you posted. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;

No Name wrote:
> > On Mon, 26 Jul 2004 16:01:45 +0200, Andor Bariska <an2or@nospam.net> > wrote: > > >Correction: > >|H(w)| = |1 - Exp(-j w)| = 2 Sin(w/2) > > I just posted a big long thing and left this out of it, but what are > H, w, and j in this function? :-x
That's the frequency response. You wanted it to be proportional to frequency. Well a sin function is close to that at the lower end of the frequency spectrum where you do most of your hearing. The difference operator or differentiator or whatever you call it is what has that frequency response shown above, which is close to what you want. To implement that you simply do this: for all n do out[n]=(x[n]-x[n-1])/2; This assumes that the array x contains white noise. You could probably leave out the divide by 2 if you want it louder. -jim -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Ah! here it is!

No Name wrote:

> Original poster here: > > First of all let me thank everyone for the rapid and cogent replies, > many of which I might have a prayer of understanding after several > years of protracted study. :-) > > I'll better clarify my problem, which I should have done in the first > place, and then attempt to address some of your replies with > quasi-intelligent questions. > > I'm trying to produce a sample of "blue noise" of arbitrary length > (say 1-10 minutes), in 16-bit signed 44.1KHz PCM. A generic monaural > wave file, basically, the same format as CDDA. That's all. So of > course I can't get true blue noise, since my chunk of the spectrum > ends at ~22KHz. And I don't need the process to be particularly > computationally efficient, as it's only going to happen once in order > to make a sample. Finally, I don't need exacting conformance to an > ideal "blue noise" spectrum. It should be close enough for government > work, so to speak, sort of like the output of Voss-McCartney is close > enough to pink noise for many.
Good. So run pink noise through a differentiator. Differentiators are easy to make. ...
> Andor replies: > >>Yes, that's the whole point - the OP asked what kind of filter to use. I >>suggested the first difference. If that isn't close enough, you can >>generate a higher order FIR approximation of the differential operator, >>but that usually is overkill.
Since the input will be noise, and the output needs only to be the derivative od SOME noise but not necessarily THAT noise stream, I'm sure that a simple difference will do. But if bandwidth is consideration, a more symmetric differentiator might be a more comfortable choice.
> Okay. I don't know what a differential operator is, nor the first > difference operator. In fact, I'm kind of afraid to venture a wild > guess, so I'll just ask, what is it? It sounds like Andor thinks this > would produce a reasonable facsimile of blue noise, which is what I > want. Can anyone suggest *holds breath* a free software package with > which I might be able to apply this sort of a filter to a pre-existing > (or generated) sample/stream of white noise?
Not exactly. First generate pink noise by some known means, then send out not the generated samples, but the difference between the current one and the last one. Then do it again. And again ...
> Bernhard Holzmayer writes: > >>High-pass filter with the 3db-point at the maximum frequency where >>your noise spectrum ends. The whole band is on the flange of the >>filter - you don't use the passband region.
>
> Wouldn't this make the entire spectrum into one octave?
No, but forget it. ...
>>If you can generate pink noise easily, just filter it with a 6 >>dB/octave high pass filter (i.e. a differentiator) to get the blue >>noise. There is plenty of literature on differentiators available >>online, and you may be able to get by with just taking the difference >>of successive samples.
That's the ticket!
> This sounds similar to the suggestions offered above about filtering > white noise. Now, based on an educated guess, wouldn't the result of > filtering pink noise in this manner have very low amplitude, as most > of the power in pink noise is at the low end, whereas most in blue > noise is at the high end?
Pink noise has many uses and ways to make from white it are well known. The blue noise you want can be made similarly, but You'd have to work out the details yourself. Using filters to go from white -> pink -> blue is more roundabout, but all the steps are well known.
>>Btw, the Voss-McCartney algorithm is a very inefficient way to >>generate pink noise. You will do much better by applying a simple IIR >>filter to a white noise stream. You can find the necessary filter >>coefficients at the music-dsp source code archive >>(http://www.musicdsp.org/). > > You're probably right. However, the Voss-McCartney algorithm is easy > to implement in assembly language for one's honors project. ;-) > Though skimming musicdsp.org, that does look even easier on the > surface. Oh well.
As you wish.
> Also, of course, I only need to generate the noise once, as I only > need samples of it (pink or blue).
You have to write the program once, no matter how many times you want to run it. It's a wash
> One erratum: pink noise is described more accurately (I believe) as > follows: "Since power is proportional to amplitude squared, the > energy per Hz will decline at higher frequencies at the rate of about > -3dB per octave. To be absolutely precise, the rolloff should be > -10dB/decade, which is about 3.0102999 dB/octave." Source: > http://www.firstpr.com.au/dsp/pink-noise/ > > I don't know what a decade is, but perhaps it makes a difference to > some of you to describe it like that.
An octave is a frequency ratio of two. A decade is a frequency ratio of ten. Pretty close, 10 octaves is three decades. 10 dB/10ade is 3 dB/8ve. (2^10=1024, 20^3=1000. Close enough for gummint work.) Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
On 27 Jul 2004 10:30:13 -0700, fumminger@umminger.com wrote:

>the Voss-McCartney algorithm is a very inefficient way to >generate pink noise. You will do much better by applying a simple IIR >filter to a white noise stream. You can find the necessary filter >coefficients at the music-dsp source code archive >(http://www.musicdsp.org/).
Relative efficiency depends on a number of factors. The Voss generator uses two random numbers for each output sample. Filtering methods use only one random number for each output sample. The Voss generator uses the same amount of processing regardless of the bandwidth of the output. IIR Filtering methods use an amount of processing that is roughly proportional to the number of octaves required. If you want a really wide output bandwidth, the Voss generator may be more efficient. Regards, Allan.
On Tue, 27 Jul 2004 22:45:33 -0400, Jerry Avins <jya@ieee.org> wrote:

>Ah! here it is! > >No Name wrote: > >> Original poster here: >> >> First of all let me thank everyone for the rapid and cogent replies, >> many of which I might have a prayer of understanding after several >> years of protracted study. :-) >> >> I'll better clarify my problem, which I should have done in the first >> place, and then attempt to address some of your replies with >> quasi-intelligent questions. >> >> I'm trying to produce a sample of "blue noise" of arbitrary length >> (say 1-10 minutes), in 16-bit signed 44.1KHz PCM. A generic monaural >> wave file, basically, the same format as CDDA. That's all. So of >> course I can't get true blue noise, since my chunk of the spectrum >> ends at ~22KHz. And I don't need the process to be particularly >> computationally efficient, as it's only going to happen once in order >> to make a sample. Finally, I don't need exacting conformance to an >> ideal "blue noise" spectrum. It should be close enough for government >> work, so to speak, sort of like the output of Voss-McCartney is close >> enough to pink noise for many. > >Good. So run pink noise through a differentiator. Differentiators are >easy to make.
Yes, this is the important crux of the matter (that may have been implied in other posts too, although I didn't see it) - run PINK noise (not WHITE noise) through a differentiator. Differentiated white noise is purple noise. Tony (remove the "_" to reply by email)
"Andor Bariska" <an2or@nospam.net> wrote in message
news:41050c8a$1@pfaff2.ethz.ch...

> Yes, that's the whole point - the OP asked what kind of filter to use. I > suggested the first difference. If that isn't close enough, you can > generate a higher order FIR approximation of the differential operator, > but that usually is overkill.
Approximating the differential operator will give a psd of f^2, not f. You are thinking of amplitude, not power. -Frederick Umminger
Randy Yates wrote:
> an2or@mailcircuit.com (Andor) writes: > > [...] > > If I had to create noise with psd ~ f, I would filter white noise with > > the differential operator, which has a frequency response of f. A > > computationally extremely efficient approximation would be to use the > > first difference operator with impulse response h = {1,-1}. > > Wasn't there a song written about this? "Don't it make your brownian motion > blue?" ...?
Haha, that's good - who's song is that?