I have just added a new program to the repository, a Noise Generator.
The generator uses a fast algorithm (see here) to produce the random values that make up the noise. I modified the code slightly so that it outputs 8 bit values with a 32 bit-long period, more than long enough to avoid perceiving patterns.
By default, the generator outputs a signal that would be white noise, were not for the low-pass filter included in miniMO’s output; spectral analysis shows a roll-off starting at around 3KHz. I cannot therefore say this noise has a particular color, but I’m very pleased with the result anyway.
The generator gives control over three parameters: grain density, frequency, and amplitude:
- “Density” and “frequency” are the perceived effects of modifying the timers that generate the PWM: changing the reset counter for timer1, which generates the base pulse, has the effect of making the noise more sparse until it decomposes in individual grains, while changing the counter for timer0, which generates the interrupt, has the effect of filtering its base frequency and harmonics, perceived as a notched low-pass filter of sorts
- Amplitude is much more straightforward, but has a couple peculiarities
- It is modified only by external sources; this is by design, as I wanted to keep things simple and I believe amplitude control makes sense mostly to modulate it with an LFO or an envelope generator, for sweeps, chopped or percussion effects
- When the density is low, the amplitude control will also interact with it: you get both a drastic amplitude modulation and a less drastic density modulation. I don’t quite understand why this is the case, but I kind of expect weird things to happen when tampering with the timers in such ways
PS. I configured the program to produce nice noise and smooth sweeps, but there’s room for experimentation by modifying the timer’s prescalers. For instance, using TCCR0B = (1<<CS02) divides the base clock frequency by 64 rather than the default 8, allowing for some crude tones and variations. Lots of fun! 🙂