[sdiy] Digital oscillators [was: Active VCO temp compensation]

Antti Huovilainen ajhuovil at cc.hut.fi
Wed Dec 24 09:35:27 CET 2008


I forgot to list some equivalences and other things which turn out to be 
useful for deciding which method to use.

First, the list of methods:
1) Trivial saw with oversampling
2) Sum of sines
3a) Differentiated parabole wave (DPW)
3b) Slewrate limited saw
4) Mipmapped wavetables
5a) BandLimited Impulse Trains (BLIT)
5b) BandLimited StEps (BLEP)

BLEP (5b) with N FIR phases and without interpolation between the 
integrated FIR phases is equivalent to trivial saw with N 
times oversampling using the same FIR filter for decimation.

DPW/slewrate limited saw are equivalent to oversampled trivial saw with 
infinite oversampling using one destination sample long box filter for 
the decimation.

Therefore BLEP with interpolation between phases is equivalent to N times 
oversampled DPW/slewrate limited saw.

Every integration before sampling means an additional 6dB/oct alias 
attenuation.

On Tue, 23 Dec 2008, Seb Francis wrote:

>> 1) Trivial saw with oversampling
> This is what I had in mind to start with.  I was going to try something 
> like 1MHz sampling rate, but you're saying that 3MHz+ is going to be 
> needed for a good sound.

Yes. See the beginning of this post.

> What do you mean by 'high quality' lowpass filtering? ... Scott talked 
> about a 511 tap FIR filter.  This seems a *lot* to implement on a dsPIC 
> (which is what I'm using).

Something that has "significant" attenuation soon after nyquist. Basically 
most filters better than simply averaging N samples (which will NOT work).
511 taps for 2x downsampling is way overkill. For higher downsampling 
ratios you're almost always better off using multiple stages of 2^N 
decimations (probably 1-N 2^N decimations with short filters and one final 
2x decimation with longer filter).

> On my 4xD delay when I needed to halve the sampling frequency I used an FIR 
> with just 9 taps and was pretty happy with the results.  I actually quite 
> liked the sound of the more gentle roll-off.

That is a valid "artistic" design choice. As long as you (and others) are 
aware what is happening

> This sounds interesting.  Am I understanding right that it would need a 
> separate table for each type of waveform discontinuity - so a pulse, up saw, 
> down saw could all use the same table for their transitions, but a triangle 
> wave would need a different table of steps?  And presumably this can't be 
> applied to something like a sine, or complex waveforms?

Yes. The tables don't have to be that long though. With 2x oversampling 8 
taps is enough and with interpolation 16 phases should do fine.

Normal sine doesn't need bandlimiting, but sync will. Sine sync is 
problematic as each discontinuous derivative requires separate 
bandlimiting. In practise bandlimiting the step and one or two derivatives 
is enough as aliasing from further derivatives falls off very fast 
(18dB/oct and more).

> In my case I want to have many oscillators, each slightly detuned, so I 
> guess the amount of maths is going to add up and there's going to be a 
> point where it becomes better to just using simple 
> oversampling/filtering/decimating.

If you want to do it cheaply, I'd suggest 2x oversampled slewrate limited 
saw (can be used for PWM too by subtracting two saws). For high quality, 
you can't really beat BLEP.

Antti

"No boom today. Boom tomorrow. There's always a boom tomorrow"
   -- Lt. Cmdr. Ivanova



More information about the Synth-diy mailing list