[sdiy] PIC-based Digital Oscillator question

Tom Wiltshire tom at electricdruid.net
Sun Apr 24 00:20:59 CEST 2011


On 23 Apr 2011, at 22:55, Ian Smith wrote:

> 
> 
>> Hi Ian,
>> 
>> Have a look at the VCLFO code on my website:
>> 
>> http://www.electricdruid.net/index.php?page=projects.lfo9
>> 
>> It's a phase accumulator based oscillator, in this case at low frequencies not audio, but the principles the same.
>> There's a quirk in that I implemented simple phase distortion ("waveform distortion") so it uses different frequency increments for the first half of the waveform and the second half, but you can ignore that.
>> 
>> HTH,
>> Tom
> 
> Let me see if I am understanding this correctly: For the phase accumulator and the frequency increment, every time you overflow the phase accumulator, the frequency increment is incremented by one and the top how-many-ever bits of the frequency increment are used to look up a value from the waveform table. So the faster you increment through the phase accumulator, the higher the frequency of the output.
> -Ian

Nearly. There's no need to alter the frequency increment. 

Every sample you add the frequency increment to the phase accumulator, and then you use the top how-ever-many bits for the lookup, like you said. The larger the frequency increment, the faster the phase accumulator will overflow and the higher the frequency of the output.

There's a page on my site explaining the principles if you're interested:

http://www.electricdruid.net/index.php?page=info.dds

Tom.


More information about the Synth-diy mailing list