Subject: Re: [linux-audio-user] Bandlimited oscillator plugins for LADSPA ('blop-0.1.0')
From: Paul Winkler (pw_lists_AT_slinkp.com)
Date: Fri May 17 2002 - 20:14:46 EEST
On Fri, May 17, 2002 at 12:52:27PM +0100, mike rawes wrote:
> I'd be interested to see how you did yours (in
> particular the anti-aliasing hack - do you use
Mine is based on a pretty simple, naive approach:
Sharp edges on waveforms produce infinite harmonics
and therefore aliasing; therefore let's get rid
of the sharp edges. Amazingly, it sounds pretty good.
To do that, I have two wavetables: a full cycle of
a triangle wave, which we loop through at the frequency
we want, and a half-cycle of a sine wave at 90 degrees
so it starts at -1. The triangle wave is normalized to
the range 0 ... 1 and then scaled to the length of the half-sine,
and used as an index to get a value from the half-sine table.
So far, all this does is produce a sine wave. But if
we clip the triangle wave and rescale it so it's
always in the range 0 ... length of half-sine,
we can get many interesting effects.
For instance, if the lower limit of the triangle
(before rescaling) is 0.45 and the upper limit
is 0.55, the output of the table lookup will be
very much like a square wave except the transition
will be a smooth, steep curve instead of a sharp break.
If the lower limit is 0.9 and the upper limit is 1,
the output of the table lookup will be a pretty smooth
So we need to control two variables, the upper and
lower bound of the clipping range. These are
controlled and modulated however you want to produce
the desired pseudo-pulse, but then they are scaled
appropriately with the frequency of the note such that
increasing the frequency forces the upper limit to be
closer to 1 and teh lower llimit to be closer to 0.
So at the nyquist frequency, the output is a pure sine wave.
Make sense? Anyway, pwm2.saol gives the idea, though
if you're not familiar with saol you might have to look
up some things here:
Paul Winkler home: http://www.slinkp.com "Muppet Labs, where the future is made - today!"
This archive was generated by hypermail 2b28 : Fri May 17 2002 - 19:52:54 EEST