Page 1 of 1

High quality Pink Noise generation

Posted: Sat Jul 29, 2017 4:52 pm
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?

Re: High quality Pink Noise generation

Posted: Sat Jul 29, 2017 5:59 pm
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.

Re: High quality Pink Noise generation

Posted: Sat Jul 29, 2017 6:53 pm
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:

Re: High quality Pink Noise generation

Posted: Sun Jul 30, 2017 12:02 am
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.

Re: High quality Pink Noise generation

Posted: Sun Jul 30, 2017 6:07 am
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.

Re: High quality Pink Noise generation

Posted: Mon Jul 31, 2017 5:38 pm
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!

Re: High quality Pink Noise generation

Posted: Mon Jul 31, 2017 6:25 pm
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. :|

Re: High quality Pink Noise generation

Posted: Mon Jul 31, 2017 8:52 pm
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.

Re: High quality Pink Noise generation

Posted: Tue Aug 01, 2017 1:53 am
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".