LFSR Noise Plugin

I made an LFSR noise generator awhile back that’s good to go at this point if anyone would like to use it. I made a PR to add it to the community plugins, but I thought I’d share it in the mean time. Features include arguments for frequency, feedback index, manual reset trigger for the internal 32 bit integer (also automatically resets if the integer reaches a terminal state), different behaviors for when the LFSR gets reset. It works great as a noise source, oscillator, pseudo-random gate/trigger. It also has a friendly neighborhood help file.

6 Likes

What is the advantage of this over the standard noise generators that come with SuperCollider?

Glad you asked!

LFSR Noise Generator:

  • Mechanism: Utilizes a Linear Feedback Shift Register to generate pseudo-random sequences. It’s deterministic but seems random.
  • Unique Features: Offers control over the noise character through frequency (how fast the bits are generated) and feedback index (which bits affect the next bit in the sequence), allowing for nuanced adjustments in timbre and rhythmic qualities. The periodicity of the random sequence is MUCH more obvious (meaning it can essentially function as an oscillator as well as a noise source).
  • Also has a very unique, distinctly lofi/8 bit quality to it thanks to its use in the NES and GameBoy sound card.

WhiteNoise:

  • Mechanism: Generates random signals at all frequencies with equal intensity, resulting in a static, “hissy” sound.
  • Unique Features: Lacks control over frequency and timbre; it’s pure randomness without a discernible pitch. It’s technically not random, but the sequence of random values repeats after something like a day at a more typical audio sample rate like 48k. It’s still more than 12 hours at 96k though.

LFClipNoise & LFNoise:

  • Mechanism: These are noise generators with frequency arguments. You can set them to the sample rate if you like though. LFClipNoise generates either positive or negative 1, while LFNoise... produces random values with or without some kind of interpolation (suffix 0-2). If you run it at the sample rate, they’ll all be the same though because LFNoise doesn’t oversample.
  • Unique Features: Have frequency arguments, but have a greater degree of randomness than an LFSR, just like WhiteNoise.

PinkNoise:

  • Mechanism: Generates noise that has a decreasing power density spectrum as frequency increases (it’s basically lowpass filtered), leading to a more mellow sounding noise source.
  • Unique Features: It sounds different from WhiteNoise. Some people prefer it to WhiteNoise for electronic snares.

BrownNoise (Brownian Noise):

  • Mechanism: Generates noise with a power density that decreases 6 dB per octave, emphasizing lower frequencies for a deeper, rumbling texture.
  • Unique Features: Offers a more pronounced low-end.

Dust2:

  • Mechanism: Generates bursts of white noise impulses at a specified density. It’s akin to random dust particles hitting a surface, with Dust2 specifically generating bipolar impulses.
  • Unique Features: Controlled by density rather than frequency, offering a granular approach to noise generation, which is distinct from the sequenced, bit-based method of LFSR.
2 Likes

The description sounds similar to DNoiseRing | SuperCollider 3.12.2 Help, although that’s a Demand rate ugen.

Thanks! This does indeed sound like an excellent addition to the toolbox. I will definitely be using this.

The grey noise oscillator in supercollider actually doesn’t generate gray noise, but instead uses Gray codes. I found this out the hard way… :sweat_smile:

Brown noise is also sometimes call red noise.

A greynoise ugen would probably be a nice addition, as would a blue noise plugin. Also velvet noise if you’re feeling inspired :slight_smile:

I think DNoiseRing is closer to Turing Machine in its implementation. There’s no extra randomness in LFSRNoise – no probability of either setting new values or not. LFSRNoise always does the bitshift/feedback thing unless it hits zero, in which case it just resets itself. The output is completely deterministic. But you can get similar sounds with both. DNoiseRing is just more stochastic and also demand rate.

You can accomplish most of these things with filters and pseudo ugens if you really want to just be able to BlueNoise.ar, etc. whereas an LFSR made more sense to write an actual UGen for. It’s extremely lightweight and efficient, plus you get really simple handling of the arguments for feedback index, some helpers to keep it from getting stuck as you modulate the controls, a trigger to get some cool transient sounds, and a selection of different behaviors for when the internal integer is reset.

This is very different from colored noise, which is related more to spectral power density, which you would accomplish by filtering. LFSR has nothing to do with filtering, really. It doesn’t have a constant power spectral density. It can get pretty close, but the cool thing is that it usually does not get very close. That is to say, it’s basically an oscillator that has varying degrees of noisiness. If you use a feedback index value of 2, you basically get a pulse wave. If you use something like 14, it’s pretty noisy.

1 Like

Here are some audio examples. The frequency of each is set to 22050 Hz.

LFNoise1:

LFSRNoise:

Index: 6

Index: 14

Index: 10

1 Like

Really nice, thanks for sharing!

1 Like

Sorry to bump this thread again, but I just put up a new version with a phase interpolator. Why I didn’t do that to begin with I’m not really sure but enjoy!

2 Likes