[sdiy] Experiment with bandlimited ramps

Tom Wiltshire tom at electricdruid.net
Wed Jan 7 10:21:49 CET 2009


On 7 Jan 2009, at 01:34, Seb Francis wrote:

> So let me get this right...
>
> You have a simple saw oscillator, stepping at your desired output  
> sample rate (62.5kHz?).

Yep. It's a simple NCO at it's heart.

> The value of the saw is used to lookup the actual sample value from  
> the closest wavetable, in your case not using any interpolation  
> between samples, but more ideally using linear interpolation  
> between adjacent samples, or better still an FIR over a larger  
> range of points.  Yes?

Yes again. I have two frequency variables. One is a 16-bit "V/Oct"- 
scaled number of which the top three bits give the octave and the top  
four bits are used to determine which half-octave table to use. This  
value then goes through a exponential convertor to generate a linear  
frequency increment for the NCO. This linear frequency increment is  
the second variable.

Linear interpolation between sample points would help improve the  
quality, and higher order or FIR interpolation would be better still.

> Each table is a single cycle at a fixed sample rate, and so you  
> have to do a multiply by the table length for each lookup.  Am I  
> getting it so far?
>
> What sample rate do you use for your wavetables?  The same as the  
> output sample rate?

No. The wavetables are heavily oversampled. This compensates to some  
degree for the lack of interpolation between samples. I used table  
sizes of 2048, 1024, 512, and 256 for the highest tables.
No multiply is required for the lookup. The NCO phase accumulator is  
a 32-bit counter, so the lookup just uses the appropriate number of  
bits from the top of the counter (the top 11 bits for the lowest  
tables, the top 8 bits for the highest).
The remaining bits of the phase accumulator would be used for the  
interpolation if there was any.

> I guess the quality would be improved by using higher than output  
> sample rate for the wavetables, or using linear interpolation or  
> better a short FIR to read the point from the table.

Yes, and I used the first of those techniques. In short, I used RAM  
instead of processor cycles.

> I suppose you are getting away with not interpolating the sample  
> point by virtue of the fact that you are only using 64 harmonics.

Yes. Even the highest harmonic in the highest table has 4 points per  
cycle, half of nyquist. For most of the range, the figure is much  
better than this. Oversampling the wavetables by a factor of 16 hides  
a lot of errors. Again, this was exactly what Korg did in the DW  
series way back in the 80s, so I'm not taking any credit for an  
original idea.

Hope this helps,
Tom





More information about the Synth-diy mailing list