[sdiy] Experiment with bandlimited ramps
Tom Wiltshire
tom at electricdruid.net
Wed Jan 7 01:49:30 CET 2009
Seb,
On 6 Jan 2009, at 23:20, Seb Francis wrote:
> By the way, what's the use of generating these bandlimited ramps
> anyway? Can you actually use them to make an oscillator?
Yes, you can. My DWGS oscillator code for the 33FJ128GP802 dsPIC does
exactly this. It generates a series of wavetables with decreasing
harmonic content at half-octave intervals over 8 octaves. Antti
mentioned this technique as (4) Mipmapped wavetables. You should
definitely consider it among your other approaches.
> Surely they are only good for 1 frequency/note. Do you need to
> generate a waveform for every note in the bottom octave? And then
> how do you handle pitch bend and FM, etc.?
Obviously there are compromises. But they don't have to make the
whole business impossible. Assume that 150 harmonics are enough to be
regarded as "full bandwidth". The bottom table with all 150 harmonics
can be used for two whole octaves from 40Hz to 160Hz. After that,
you'll have to start rolling off the harmonics to avoid aliasing. You
can simply switch from one table to another at a zero-crossing. For
half-octave tables, the jumps between tables are very minor even if
you don't bother waiting for a zero-crossing.
The better way is to crossfade(interpolate) between one table and the
next one up, but that costs you more lookups and another multiply for
the interpolation.
One compromise is that rather than fading out gradually and one by
one, the higher harmonics disappear in groups since one table will
have many less than the previous table. In practice this isn't half
as bad as it sounds, especially if Nyquist is higher than the upper
limit of hearing, since then the disappearing harmonics can be
inaudibly high.
My own oscillator uses only 64 harmonics, no interpolation between
table samples, and no interpolation between tables. On the face of
it, you'd think it sounds awful, but in fact it's quite passably
good. I was encouraged to keep going by the Korg DW series synths
which inspired me - these used no interpolation either, plus being
only 8-bit at 50KHz sample rate, and yet sounded pretty good. I was
able to increase the resolution to 16-bit and the sample rate a
little to 62.5KHz.
Regards,
Tom
More information about the Synth-diy
mailing list