Re: 200+ sine oscillators on iOS
Re: 200+ sine oscillators on iOS
- Subject: Re: 200+ sine oscillators on iOS
- From: Ross Bencina <email@hidden>
- Date: Wed, 30 May 2018 13:26:57 +1000
On 29/05/2018 1:28 PM, Brian Willoughby wrote:>> On May 27, 2018, at
1:08 PM, Paul Davis <email@hidden> wrote:
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.
Any finite computation of the sine function is going to have error. But
you can easily drive the error below the LSB.
A table lookup oscillator will use interpolation. For a given error
bound the trade-off is between table size and interpolation strength.
Either you use a high-quality interpolator and a shorter table, or a
low-quality interpolator (e.g. cubic hermite, or linear) and a larger table.
Even "doing the math" usually boils down to having a short lookup table
(a few cache lines) and high-order interpolation for short segments of
the sine period.
On 28/05/2018 6:08 AM, Paul Davis wrote:
> wavetables for sine waves are a mid-90s idea.
Pretty sure it dates back long before the 90s.
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.
Just a note: SVF is not the only formulation of a feedback sine
oscillator (a literature search brings up a bunch, including one from
Max Matthews.) I like the "high-precision" method described here:
http://groovit.disjunkt.com/analog/time-domain/fasttrig.html
But frequency modulation is a hassle with any of these recursive
methods, since you need to recompute the coefficients -- usually with an
=accurate sin() calculation, which may defeat the purpose.
There is some old discussions of sine lookup tables and low-order
polynomial approximations here:
http://www.rossbencina.com/code/sinusoids
Ross.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden