Difference between revisions of "Creating Bluish Noise With Minimal Compute"

From 8BitDev.org - Atari 7800 Development Wiki
Jump to: navigation, search
Line 17: Line 17:
 
The algorithm creates the expected +3 dB per octave power increase, and works equally well with LFSR noise sources.
 
The algorithm creates the expected +3 dB per octave power increase, and works equally well with LFSR noise sources.
  
The algorithm can produce bluer noise by adding more random values into the comparison, at the expense of adding more compute time. The algorithm as presented produces noise that is strikingly blue (but not perfectly blue) so it's probably not worth the additional effort.
+
The algorithm can produce bluer noise by adding more random values into the comparison, at the expense of adding more compute time. The algorithm as presented produces noise that is strikingly blue, as can be seen in the following Spectrum Analysis section, so it's probably not worth the additional effort.
  
 
== Spectrum Analysis ==
 
== Spectrum Analysis ==

Revision as of 15:54, 23 May 2024

Often random numbers are referred to as "noise", and sometimes we attach colours to refer to the different characteristics of that noise. The colours reference power characteristics at at different frequencies, but those power characteristics are the ultimately the result of how the random values are distributed.

Blue noise is a type of noise with a power density that increases with frequency, giving it a high-pitched, hissy sound. Visually, it manifests as a pattern with minimal low-frequency components and a relatively even distribution of points, and is frequently used for dithering. Blue noise is often used for its aesthetically pleasing randomness, since numbers don't clump together as they would with truly random (white noise) sources.

The Algorithm

Blue noise is typically created by generating random values, and massaging them in various ways to not be as clumpy. This isn't a great approach for older platforms that don't have a lot of compute horsepower or ram.

An alternative approach, is to blue the noise by using an exponentially decaying average and ensuring new random numbers aren't near recently used values...

A=RAND
B=RAND
if ABS(B-C) > ABS(A-C) then A=B
C=(C+A)/2 ; exponentially decaying running average
; "A" is holding your next bluish noise value

The algorithm creates the expected +3 dB per octave power increase, and works equally well with LFSR noise sources.

The algorithm can produce bluer noise by adding more random values into the comparison, at the expense of adding more compute time. The algorithm as presented produces noise that is strikingly blue, as can be seen in the following Spectrum Analysis section, so it's probably not worth the additional effort.

Spectrum Analysis

Authorship

The novel Bluish Noise technique described here was created by Mike Saarna.