High quality Pink Noise generation

Programming applications for making music on Linux.

Moderators: MattKingUSA, khz

Post Reply
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

High quality Pink Noise generation

Post by CrocoDuck »

Hi guys!

Up to now every time I need some pink noise I pretty much to what the FAUST libraries do: create white noise and filter it through an IIR. From FAUST libraries source code:

Code: Select all

//---------------------------`pink_noise`--------------------------
// Pink noise (1/f noise) generator (third-order approximation)
// `pink_noise` is a standard Faust function.
//
// #### Usage
//
// ```
// pink_noise : _;
// ```
//
// #### Reference:
//
// <https://ccrma.stanford.edu/~jos/sasp/Example_Synthesis_1_F_Noise.html>
//------------------------------------------------------------
pink_filter = fi.iir((0.049922035, -0.095993537, 0.050612699, -0.004408786),
                    (-2.494956002, 2.017265875, -0.522189400));

pink_noise = noise : pink_filter;
I always use the coefficients above for the IIR, also when I implement somthing by myself. So:
Numeartor: (0.049922035, -0.095993537, 0.050612699, -0.004408786)
Denominator: (-2.494956002, 2.017265875, -0.522189400)

However, I found that the output noise is not very pinkish at the very low end: its spectrum becomes flat below a certain frequency. Which isn't a problem, but at work we have a 01dB signal generator program that outputs way pinker noise through the same soundcard I use to test my code (I analysed the audio output with a professional 01dB analyser).

So, I am left wondering: is there a better algorithm to generate very accurate pink noise (apart from using a higher order IIR)? Are you aware of any?
User avatar
sadko4u
Established Member
Posts: 986
Joined: Mon Sep 28, 2015 9:03 pm
Has thanked: 2 times
Been thanked: 359 times

Re: High quality Pink Noise generation

Post by sadko4u »

The main problem is because you're using bilinear transformed filter to filter the white noise. Bilinear-transformed low-pass filter will always be zero at the Nyquist frequency. Instead of using bilinear-transformed filter you should use matched-transformed filter. This is present in LSP plugins.
You have access to LSP code and can simply write white noise generator plugin and filter it with MT filter.
LSP (Linux Studio Plugins) Developer and Maintainer.
tramp
Established Member
Posts: 2335
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 454 times

Re: High quality Pink Noise generation

Post by tramp »

sadko4u wrote:You have access to LSP code and can simply write white noise generator plugin and filter it with MT filter.
This is absolutely the wrong place talking about close source algorithm, please continue in private or elsewhere. :evil:
On the road again.
User avatar
sadko4u
Established Member
Posts: 986
Joined: Mon Sep 28, 2015 9:03 pm
Has thanked: 2 times
Been thanked: 359 times

Re: High quality Pink Noise generation

Post by sadko4u »

tramp wrote:
sadko4u wrote:You have access to LSP code and can simply write white noise generator plugin and filter it with MT filter.
This is absolutely the wrong place talking about close source algorithm, please continue in private or elsewhere. :evil:
Please don't frustrate, you always can make it open source by donating the project.
All the best.
LSP (Linux Studio Plugins) Developer and Maintainer.
tramp
Established Member
Posts: 2335
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 454 times

Re: High quality Pink Noise generation

Post by tramp »

sadko4u wrote:Please don't frustrate, you always can make it open source by donating the project.
All the best.
Ha, Ha, good countered. :)

But indeed, it would be nice if you discuss your internals on your own channel, as most of us been excluded when talking about your source code, even if it is only for now.
On the road again.
ssj71
Established Member
Posts: 1294
Joined: Tue Sep 25, 2012 6:36 pm
Has thanked: 1 time

Re: High quality Pink Noise generation

Post by ssj71 »

tramp wrote: This is absolutely the wrong place talking about close source algorithm, please continue in private or elsewhere. :evil:
I don't think it is. Linux is not strictly open source. Of course I wish everything were open source, but if ANYONE is willing to share insights to help improve algorithms and DSP techniques I'm all ears!
_ssj71

music: https://soundcloud.com/ssj71
My plugins are Infamous! http://ssj71.github.io/infamousPlugins
I just want to get back to making music!
tramp
Established Member
Posts: 2335
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 454 times

Re: High quality Pink Noise generation

Post by tramp »

ssj71 wrote:I don't think it is. Linux is not strictly open source. Of course I wish everything were open source, but if ANYONE is willing to share insights to help improve algorithms and DSP techniques I'm all ears!
Well, you could go this way, but, for me, if you refuse to share your source with me, I wont share mine with you, simply as is.
Just, I share my source anyway. :wink: , as it is GPL'ed.
For sure, I've no interest in talking about stuff like
sadko4u wrote:You have access to LSP code and can simply write white noise generator plugin and filter it with MT filter.
:shock:

By the way, you'll find a couple of (source code) pink noise generators (GPL'ed) in the NET, which do exactly that.

So, if you believe your source is such a secret, just keep it. :lol:

Let alone the donation ware approve, we all know, it isn't GPL compatible. :|
On the road again.
User avatar
sadko4u
Established Member
Posts: 986
Joined: Mon Sep 28, 2015 9:03 pm
Has thanked: 2 times
Been thanked: 359 times

Re: High quality Pink Noise generation

Post by sadko4u »

tramp wrote:By the way, you'll find a couple of (source code) pink noise generators (GPL'ed) in the NET, which do exactly that.
I thought you've already ended up with frustrations but you're still frustrating. That's sad.
tramp wrote:So, if you believe your source is such a secret, just keep it. :lol:
I don't belive my source is secret. I've provided access to the source code for Stefano Tronci aka CrocoDuck that helps me with development, Robin Gareus aka x42 that is always welcome when there are some unclear questions related to interaction between Ardour and LSP and (surprise!) Filipe Coelho aka falkTX.
tramp wrote:Let alone the donation ware approve, we all know, it isn't GPL compatible. :|
GPL is not the holy grail to pray to. There are many GPL-aware open source projects that have good and normal lifecycle without GPL.

Anyway, I'm still keeping all promises to publish the source code, so part of code is already accessible:
https://sourceforge.net/p/lsp-plugins/s ... p-plugins/

Also all donations ever made are viewable here:
https://salt.bountysource.com/teams/lsp ... supporters

So it's curiously to think that I'm trying to fool somebody.

By the other side, I'm not trying to sell licenses to you. I'm not trying to cry in petitions asking Waves, Steinberg or some other proprietary audio company to port their stuff to Linux. And I'm also not pissing with boiling water from news that OverToneDSP has returned their support of plugins under Linux.

I'm just spending my own time trying to make audio processing under Linux better. And I believe that part of time I've spent should be refunded.

There are only two problems. The first one is motivation, and it's pretty clean: good motivation is always the consequence of the positive feedback.
The second problem is more general. I'm not immortal, so... you know what I mean.
LSP (Linux Studio Plugins) Developer and Maintainer.
tramp
Established Member
Posts: 2335
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 454 times

Re: High quality Pink Noise generation

Post by tramp »

sadko4u wrote:I thought you've already ended up with frustrations but you're still frustrating. That's sad.
frustrating, is that your "word of the week, or what? :lol: :lol:
sadko4u wrote:So it's curiously to think that I'm trying to fool somebody.
I don't think that, if I made this impression, sorry me.
All is, I've just no interest to talk/read about source, which isn't made accessible by the developers ( in this special case, you).
sadko4u wrote:Anyway, I'm still keeping all promises to publish the source code, so part of code is already accessible:
I'm not interested in it anyway, as, your license text make your source code in-usable for the debian project. It's far away from being "free".
On the road again.
Post Reply