shorepine / amy

AMY - A high-performance fixed-point Music synthesizer librarY for microcontrollers
https://shorepine.github.io/amy/
MIT License
188 stars 11 forks source link

Pitched noise oscillator #68

Open dpwe opened 9 months ago

dpwe commented 9 months ago

The wave=RANDOM oscillator doesn't use its freq/note argument at present: It always generates full-band white noise.

Recently, when working on the Loris partials, we removed its ability to synthesize "noisy" partials, since it didn't seem that useful.

However, the general idea of an oscillator that generates narrowband noise around a center frequency seems quite useful. We can do this with the white noise source and a bandpass VCF to set the band. But that's a clumsy control interface if we want to, for instance, carry a melody on the noise.

A new oscillator mode to generate narrowband noise without a filter could be useful. We could use the freq arg to set the center frequency, then a second arg (filter_freq?) to define the bandwidth.

Inspired by the former Loris partial implementation, we could have a lookup table of band-limited noise, use the bandwidth parameter to control the lookup table playback (setting the bandwidth of the noise), then multiply it by a sinusoid at the note frequency (to shift the center frequency of the noise).

The weakness here is that periodic noise (as you'd get with a short lookup table) is typically perceived as pitched rather than noisy. We'd need a large table to avoid this.

On the other hand, we can sample from a very long implicit random sequence using a random function. However, the value of the lookup table is that it has the lowpass nature built-in (making cheap linear interpolation adequate). If we generated noise on-the-fly, we'd need to use more expensive interpolation to get good frequency behavior, but we could optimize that for a single frequency, then treat its output as if it was a large bandlimited noise lookup table.

smutax commented 9 months ago

I think this was part of what @octetta was asking about in #31! Thanks for following it up!

octetta commented 9 months ago

This is exactly what I was asking about and what I was hoping for. For the Python challenged (ME), here's the wire protocol equivalent of what DAn mentioned in #31

v1w5f4a0.1
v0w0g4L1
v0n64l1