Forums > Dev

How to interpolate within a wavetable oscillator?

March 12, 2010 | 1:25 pm

Hello Developers,

I’m currently building a wavetable-based oscillator like [cycle~] with some own functionality I need. I know that [cycle~] uses some kind of interpolation to calculate its output but I don’t know how is this done in an efficient way (I suppose there must be some trick that makes things faster than simply choosing the two closest values to the current phase of the oscillator and do the interpolation, which consumes a lot of CPU as I suppose). Can somebody give me some hints to do this?

Thank you,
Adam


March 12, 2010 | 5:32 pm

Have a look at SC, the SinOsc UGen for example:

http://supercollider.svn.sourceforge.net/viewvc/supercollider/trunk/common/Source/plugins/OscUGens.cpp?view=markup

SC source is generally looking at how to do stuff efficiently.

The key to this is avoiding doing an "if" in the main DSP loop for every sample. SC uses bit masking etc for this.


March 12, 2010 | 9:16 pm

Should have read "SC source is generally go for looking at how to do stuff efficiently" …


March 12, 2010 | 10:28 pm

there is some info about doing fast table lookup here:

http://www.kvraudio.com/forum/viewtopic.php?t=272457&postdays=0&postorder=asc&highlight=table+lookup&start=0


Viewing 4 posts - 1 through 4 (of 4 total)