How to create Brown Noise in Max?

uforange's icon

Hello,

It seems that Max has two noise-generating object called noise~ and pink~ but I am wondering how to make brown noise instead? Thank you so much for your help!

Roman Thilenius's icon


vb.brown~, litter power, err, some more.

vanilla... also possible but i dont know offhand.

uforange's icon

Thanks!! @ROMAN

Luigi Castelli's icon

For vanilla Max it would be the [drunk] object

uforange's icon

Thank you @LUIGI CASTELLI Thank you for letting me know. I am currently googling Vanilla Max but it is difficult to find it. https://github.com/hexxd/vanilla this is not the one you mentioned, right?

florian1947's icon

vanilla just means: basic, no extras - Max as you bought it.
A lot of punch is added with externals from outside programmers. A bit like plugins.
The (vanilla) Max [drunk] object doesn't seem to work audio rate.
Easiest would be the vb.brown~ external, from Volker Boehm (him Google will find)

uforange's icon

@FLORIAN1947 Got it! Now I know what Vanilla means haha. I am trying vb.brown~ now, and it works. It says I can adjust an initial step size with the first argument of vb.brown~. But I am wondering what "initial step size" means here. Perhaps, the value distance between each step? Can you please correct me if I am wrong? Thank you!

Luigi Castelli's icon

No, [drunk] does not work at audio rate.
I am sorry I haven't read your initial question carefully enough.
If you need something that works at audio rate, then you can only use 3rd party externals as Max doesn't come with an audio rate brown noise generator out of the box.
When it comes to random noise generators Litter Power is my favorite collection.
The external you are looking for is called: [lp.pfff~]

Roman Thilenius's icon


"vanilla" means factory externals or "patch yourself". ;)

according to p. castines brownian noise patch you need nothing more than the [drunk]
object.

but i dont think that it is legal to just scale this to -1 1 in order to get a 1/f*f type of noise signal spectrum.

not to speak of the "scatter" parameter in his patch.

also, to my knowledge, there is no drunk~ object for MSP.

this seems to work. have fun to make a signal version, haha.

Luigi Castelli's icon

It is easy enough to make a vanilla brown noise generator in [gen~]
Here you go...

brownian_noise~.maxpat
Max Patch

Roman Thilenius's icon


gen~ is strawberry

Luigi Castelli's icon

You are right Roman, I cheated a little bit... :)

uforange's icon

thank you @LUIGI and @ROMAN!! but I was wondering what the step size means.

Luigi Castelli's icon

Step size is the amount of random steps taken for every iteration. It makes the noise more jagged and bumpy as opposed to flat and leveled.
A good way to understand what it does is to change the step size and see how the output changes in relation to it.
It's the same as the right inlet of the [drunk] object or the float message for the [vb.brown~] object.
Check their help files.
Hope this helps, over and out.

Peter Ostry's icon

On GitHub you can get 17 noise externals:
https://github.com/sbl/sc-max

https://github.com/sbl/sc-max/releases/download/1.0.0/sc-max-1.0.0.zip

"Some supercollider ugens ported to max-msp (v>6.19 - 32 + 64 bit) the focus lies on the noisier ones. Ports by Stephen Lumenta. (...)
All credits are due to the original authors (James McCartney et al.)"


sc.brownnoise~.mxo
sc.clipnoise~.mxo
sc.crackle~.mxo
sc.dust~.mxo
sc.dust2~.mxo
sc.gendy1~.mxo
sc.gendy2~.mxo
sc.gendy3~.mxo
sc.graynoise~.mxo
sc.lfclipnoise~.mxo
sc.lfnoise0~.mxo
sc.lfnoise1~.mxo
sc.lfnoise2~.mxo
sc.logistic~.mxo
sc.pinknoise~.mxo
sc.range~.mxo
sc.whitenoise~.mxo

Roman Thilenius's icon


and now to something completely different: the MSP version.

we need a volunteer.

uforange's icon

Thank you all!

👽'tW∆s ∆lienz👽's icon

(@UFORANGE ya, this is a great thread, thank you for creating it too 🍻)

Holland Hopson's icon

rand~ is capable of producing nice noise colors/flavors.

Emmanuel Dafirst's icon

I've installed this device

And it says it's missing all the object in the github mentionned earlier
https://github.com/sbl/sc-max
I've transfered thoses into my max folder
C:\Users\Users\Documents\Max 8\Packages\externals
And selected in max this folder as a path.
But somehow the project still doesnt work it keep saying
newobj: sc.brownnoise~: No such object
newobj: sc.graynoise~: No such object
etc,,
No ideas why.. i can't even create an object sc.brownnoise~ it just stay yellowed.. Any idea why ?

Emmanuel Dafirst's icon

Oh shit mxo is mac only ? it's not possible to convert them ?? sadlife..

Emmanuel Dafirst's icon

Any other way to get different flavor of noise on windows ?

AudioLemon's icon

I am having trouble getting brown noise in Max. vb.brown~ is trapped in quarantine and I could not free it even using terminal commands. Litter power is no longer available. Are there any suggestions? I do feel MSP should have a range of noise~ and different random generators as default. It has a few noise options but it should have a dedicated library. It should not be relying on old externals.

florian1947's icon

Strange. vb.brown~ is running here, in 8.5.6 on Ventura.
Finder complains first, but then releases quarantine.
Maybe an old version? He updated not too long ago.

AudioLemon's icon

Thank you for the response Florian. Much appreciated. I installed 8.6 and it worked. I was either reading the notification wrong or there is a difference between 8.5 and 8.6. It is working now - Thanks again Florian - quite often it is just the prompt I need. Thank you.

Sébastien Gay's icon

Probably a weird newbie question, but shouldn't such a simple "PFFT-flitered" noise produce some sort of brown noise ?

(but does it really make any sense to apply PFFT to a pure noise signal ?)

Sounds/looks roughly similar to vb.brown~, but with this type of sounds, comparison is sometimes uneasy, at least for me :

Roman Thilenius's icon

two sounds can have a similar frequency spectrum, but still can be quite different in the mathematical details.

i´d say for "musical" use as generator it is totally legit to use filters to shape noise.

fft... is of course not ideal. a 6db butterworth lowpass cascade should be closer.

when i think abut it, a digital white noise is also only an approximation to the real thing. :)

Peter Ostry's icon

How are these noise flavours created? There are a lot of them. Do the characteristics only arise from the calculation or is there also filtering ("cheating")?

Roman Thilenius's icon

no filters, all arithmetics on a per-sample basis.

pink is 1/f and brown/red is 1/f².

most others are distorting the distribution from linear or normal distribution, some use multiple random sources.

the difficulty about it is the signal/float implementation in MSP.

but one might argue that it is ok to use filters because that is how the analog paragon once was made, too.

Graham Wakefield's icon

If by 'brown noise' you mean brownian motion, then this is just a random walk.

In theory you can get this by accumulating (integrating) white noise (e.g. in gen~ by sending `noise` into `accum`), per https://en.wikipedia.org/wiki/Brownian_noise

Sounds good in theory but it has a lot of problems. On each sample frame you could step as much as +1 or -1, which is pretty huge. After a few milliseconds the walk will probably have got pretty far from zero and definitely won't stay in a useful -1 to 1 range -- and it's quite likely that it will stay far from zero, resulting in a huge DC bias.

You can scale down the noise source to reduce the maximum step size it can take, to reduce how quickly it wanders away. However bear in mind that this also has a strong filtering effect.

I find it more natural for a random walk to have more smaller steps, and fewer larger steps -- a more Gaussian distribution of step sizes. You can get this a few different ways (in the GO book we recommended using a variant of the Box-Muller method, but if you don't care too much about perfection, simply sending the `noise` through a `pow 3` gives a very cheap approximation.

This can still wander away and accumulate DC. The wikipedia page recommends making the integrator leaky, such as by adding a high-pass filter at a low cutoff, as a DC blocker. But now this filter setting is also going to start having an effect on the lower bands of the spectrum, and it still doesn't stop the random walk from wandering out of -1 to 1.

A different option is to apply some kind of waveshaper in the integrator loop. You can try for example `fold -1 1` or `tanh`, both will ensure that the output stays within the -1 to 1 range. This will also kill the DC, which means you don't need the highpass filter. Personally I find the `fold -1 1` to have more interesting output, and it doesn't mess up the distribution as much as tanh.

So, a combination of a) reducing total input noise range, b) noise distribution shaping, and c) waveshaping limiter can make a pretty expressive and interesting brownian noise generator.

tl;dr.

👽'tW∆s ∆lienz👽's icon

this is great to see^ ...Thank You, Graham!

...so then... since i was very impressed with Luigi's gen~ codebox above, to get similar gaussian distribution, we could just change it to this:

with(specifically for [fold -1 1]), something like:
if (z > 1.0) {
z = -2.0 + z;
} else if (z < -1.0) {
z = 2.0 + z;
}