On Wednesday, 24 February 2016 at 14:02:49 UTC, Ola Fosheim
Grøstad wrote:
On Wednesday, 24 February 2016 at 10:33:56 UTC, Tanel Tagaväli
wrote:
Hello!
I've been making some progress on the native D audio front:
https://github.com/clinei/daud/tree/28ac042a16ae6785605a9a501b5f867c8f962055
It's a continuous waveform generator, currently outputting a
saw wave that changes pitch every 1K frames.
Generating a saw waveform for an LFO is the same as generating
the phase, which is easy to do with using D's modular integers.
Just add the delta and let it wrap.
If you are generating it for a VCO then you need a bandlimited
oscilator:
https://ccrma.stanford.edu/~juhan/vas.html
(Abrupt changes in pitch will cause a discontinuity in the
second derived which is audible, so you might want to
interpolate.)
dplug:dsp has mipmapped oscillators
https://github.com/p0nce/dplug/blob/master/dsp/dplug/dsp/wavetable.d
Though it isn't fantastic aliasing-wise on the last octave, I
should try something than power-of-2s next time I need it.