> On May 27, 2018, at 1:08 PM, Paul Davis <[email protected]> wrote:
>> On Sun, May 27, 2018 at 3:53 PM, Albin Stigö <[email protected]> wrote:
>>> An oscillator based on a lookup table would work well. You only need one 
>>> table per wave type and then maintain separate pointers into the table for 
>>> each oscillator.
> 
> ​on most modern architectures, it is less costly to do the math to generate a 
> sine than it is to do memory-based lookup.​ wavetables for sine waves are a 
> mid-90s idea.

Paul is right. Lookup tables add distortion, unless you have a table for every 
possible frequency and you don’t allow pitch bends. The various methods for 
changing the pitch of a lookup table waveform all add distortion of one kind or 
another.

In contrast, a state variable filter with unity feedback can create a perfect 
sine wave that it ideal for the given sample rate and pitch, including 
frequencies with periods that are fractional sample lengths.

I benchmarked the SVF implementation with a 64-bit FFT and found the distortion 
to be very, very low - and quite comparable to the sin() function that has more 
overhead.

Brian Willoughby

p.s. I’m curious what Apple is using for their sin() function and where to 
expect the distortion to appear. The reason I’m curious is that I would like to 
make sure that my benchmark is showing any distortion that might be there.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to