[sdiy] A new shade of pink (noise)
Richie Burnett
rburnett at richieburnett.co.uk
Wed Nov 25 15:35:46 CET 2020
Yes, Tom, I think your explanation is right. Except rather than the number
getting bigger as you add more binary digits to the left, instead think of
adding extra fractional binary digits to the right. Then all of your noise
sources have the same peak amplitude, you are just adding some intermediate
fractional levels in between to allow you to do the interpolation. Then you
don't have to shift everything by the correct amount before you add up all
the totals to get equal weighting.
Did you get the ZIP file with recordings of the individual noise source
example waveforms? It didn't make it through on the list but I'll try
message you again separately.
I think the real clever bit of Stenzel's method is in the detail of how he
implements these linear interpolations. He treats the two PRBS output
levels as "-1" and "+1" from what I can recall, instead of binary 0 and 1.
Then you can feed these into an integrator which will do the ramping up and
ramping down for you. To be honest I didn't worry about optimising the
implementation detail when I looked at this, as my choice of platform
(16-bit fixed-point DSP) is different from his platform (low-end micro or
FPGA) so the optimisations might be different for me anyway. I just wanted
to understand the theory of why his new method with the linearly up-sampled
noise sources produced pink noise with better spectral conformity than the
Voss McCartney or Larry Trammell methods.
-Richie,
-----Original Message-----
From: Tom Wiltshire
Sent: Wednesday, November 25, 2020 12:28 PM
To: rburnett at richieburnett.co.uk Burnett
Cc: Benjamin Tremblay via Synth-diy
Subject: Re: [sdiy] A new shade of pink (noise)
Hi Richie,
Ok, so let me make sure I’ve got this straight…here goes.
We start off with a simple white noise source at the full sample rate. This
is a 1-bit signal, 0 or 1, no problem.
Then we add a second noise source, at half the sample rate, achieved by only
picking a new noise sample every other sample. For the ‘missing’ samples
in-between, we use a mid point value. Except I’m getting stuck again..what’s
the mid point value? This would be a 2-bit signal, so the “noise high” value
would be 0b11, and “noise low” would be 0b00, but then…what’s the midpoint
value? 0b01 or 0b10 aren’t quite right. Are we rounding down here?
Or perhaps we use 0b10 as the high value, in which case the midpoint is 0b01
(0,1,2). This makes more sense. We’re dealing with binary, so our high value
of one gets doubled to become a high value of two. Ok.
Third noise source, another octave down, same idea. We’ve got three samples
between each noise sample, and presumably we’re now onto a 3-bit signal, so
the high value is 0b100, the low is 0b000, and the steps would be 0b001,
0b010, 0b011. (0,1,2,3,4)
When we come to add everything up, we just need to make sure that everything
is shifted correctly so that the most-siginifcant bits line up so that the
higher-bit-depth signals don’t get given more weight than the
higher-sample-rate/lower-bit-depth ones, but that is simply a question of
shifting or of storing things in the right bit in the first place.
Is that about right?
Yes, in the paper he uses a 44KHz sample rate and then corrects the droopy
top of the spectrum with a pre-calculated FIR filter based a 4K lookup
table. Like you, my first thought was “just run the algorithm at 100KHz and
don’t bother with that!”.
Thanks,
Tom
==================
Electric Druid
Synth & Stompbox DIY
==================
> On 24 Nov 2020, at 19:51, Richie Burnett <rburnett at richieburnett.co.uk>
> wrote:
>
> Hi Tom,
>
> I got to the bottom of this eventually after we were discussing this
> offline a few years back. What he does is he runs the "top octave" noise
> generator at the full sample rate, then runs the next highest octave noise
> generator at half of the full sample rate, but linearly interpolates this.
> This really just means inserting one new sample between each pair of
> samples, and this is done by increasing the bit-depth. Essentially all he
> does is uses linear-interpolation to interpolate all of the successively
> lower speed noise generators up to the full output sample rate, and then
> mix them together. This is like a Zero-Order-Hold followed by an
> integrator for each successive noise source. So the next octave down runs
> at a quarter of the sample rate, and 3 new levels are inserted between
> each pair of samples to bring the output up to the full output sample
> rate. So every noise source is effectively upsampled to the final output
> rate using linear interpolation.
>
> The result of this is that each of the many noise sources running at the
> different sample rates produces an output that ramps linearly between two
> levels (with the amount of "in between" levels being determine by the
> sample rate of this noise source relative to the final output sample
> rate.)
>
> When all of the different noise sources are mixed together to get the
> final output (pink noise) it gives less ripple in the power spectrum than
> using a set of Zero-Order-Hold noise sources because the sinc-like
> spectral envelope of each noise source rolls off faster with linear
> interpolation than with ZOH. (You get an additional 6dB/oct rolloff due
> to the conceptual integration. Or you can think of it that the
> discontinuities are now in the gradient dy/dt rather than in the value y.)
>
> I remember he says something in his paper about the very top part of the
> spectral profile not having quite the right slope though, and he proposed
> correcting this with some sort of FIR filter? When I implemented it, I
> just ran the whole thing at a faster sample rate so that the part of the
> power spectrum that wasn't quite "pink" was moved above the audio band
> where human ears wouldn't notice. But for test/measurement usage it might
> be worth correcting the response with the FIR.
>
> I have to say that I didn't code this up on a PIC or dsPIC or anything
> Tom. Just wrote some equations in Goldwave expression evaluator to
> generate the relevant noise sources, mixed them together, and then looked
> at the power spectrum using MATLAB. The performance is really good, but
> you have to run the power spectrum evaluation on several minutes of noise
> in order to really get a picture for how well the power spectrum converges
> to 1/f. I think I was generating 10 minute long pink noise recordings
> with 96kHz sample rate in order to assess the residual ripple in the power
> spectrum!
>
> -Richie,
>
>
>
> -----Original Message----- From: Tom Wiltshire
> Sent: Tuesday, November 24, 2020 12:57 PM
> To: Benjamin Tremblay via Synth-diy
> Subject: [sdiy] A new shade of pink (noise)
>
> There’s an interesting paper by Stefan Stenzel on Github, describing a new
> digital pink noise generation algorithm:
>
>
> https://github.com/Stenzel/newshadeofpink/blob/master/newshadeofpink.pdf
>
>
> Has anyone seen this? I’ve read it, but there’s one thing I don’t
> understand. In the paper, he talks about taking multiple 1-bit noise
> sources (as you would in the Voss0-McCartney algorithm) but instead of
> using a “zero order hold” (e.g. “stretching” each sample) to decrease the
> sample rate, he uses linear interpolation.
> This is the bit I don’t get - how do you linearly interpolate a 1-bit
> signal? There’s nothing in between!
> He mentions at one point that the digital signal is to be interpreted
> as -1 or +1, which would mean that there is a 0 between the two values,
> but I still don’t understand how that makes sense when it’s a digital
> signal and not a bit of signal processing maths formula.
>
> Any clarifications appreciated. I’d like to understand this method better,
> but the paper is very brief, assumes quite a lot of background I don’t
> have, and doesn’t provide any worked examples for illustration.
>
> Many thanks,
> Tom
>
>
> ==================
> Electric Druid
> Synth & Stompbox DIY
> ==================
>
>
>
>
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy
> Selling or trading? Use marketplace at synth-diy.org
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
More information about the Synth-diy
mailing list