[sdiy] Approximating sine with plain integer math

John Ames commodorejohn at gmail.com
Thu Apr 7 21:57:20 CEST 2016

Huh. Interesting.

On 4/7/16, Olivier Gillet <ol.gillet at gmail.com> wrote:
> Here's what I'm talking about in terms of ugliness:
> "Naive" sawtooth (modulo counter):
> https://dl.dropboxusercontent.com/u/612135/sawtooth_naive.wav
> Band-limited sawtooth:
> https://dl.dropboxusercontent.com/u/612135/sawtooth_bandlimited.wav
> Plots:
> http://i.imgur.com/K45ljR6.png
> We are talking about all harmonics of the sawtooth wave above half your
> sample rate being folded back, to the point that they might very audible
> beat against the fundamental or add partials under it. It's aliasing
> inherent to the modulo counter itself, which is there as soon as your
> frequency does not divide the sample rate.
> This cannot be addressed outside of the oscillator by low-pass filtering,
> because the offenders are not in a specific frequency range - they are
> inbetween the harmonics of the signal. High-pass filtering can alleviate
> things a bit, but it's just better to use a band-limited synthesis method
> in the first place instead of using a naive generator.
> On Thu, Apr 7, 2016 at 9:27 PM, John Ames <commodorejohn at gmail.com> wrote:
>> Hm. Yes, that is the goal. I'm just not sure I understand what "ugly"
>> is here - are we talking aliasing noise, or just an unpleasant amount
>> of high-frequency components? Either way, it's something I have to
>> think you'd address outside of the oscillator proper, with some kind
>> of filtering, which is also going to be involved in the softsynth
>> total...
>> Maybe this is just something I'm not understanding due to being a
>> programmer with an interest in synthesis rather than a signal analyst
>> with a knowledge of programming?
>> On 4/7/16, Olivier Gillet <ol.gillet at gmail.com> wrote:
>> >>
>> >> As for bandlimiting the input...I guess I'm not even sure why you'd do
>> >> that?
>> >
>> >
>> > I thought your goal was to design an audio oscillator with a sawtooth
>> > waveform, and then to get the sine waveform "for free" just by
>> manipulating
>> > your sawtooth signal.
>> >
>> > Above a few hundred Hertz a naive sawtooth without band-limiting starts
>> > sounding ugly...
>> >

More information about the Synth-diy mailing list