[linux-audio-dev] Rectifier algorithm and Exponential FM question

Steve Harris S.W.Harris at ecs.soton.ac.uk
Tue May 6 07:20:01 UTC 2003

On Tue, May 06, 2003 at 12:05:00 +0200, Frank Barknecht wrote:
> > Sorry if this is the wrong list. I have never found a list with people
> > who can help me with these kind of questions.
> Check out the code archive on musicdsp.org.

Definatly. Check the mailing list archives too.
> > I am trying to figure out how a rectifier works in code. I have created
> > something like it using tanh() distribution ( which will turn a sine
> > wave into a sort-of-square wave). I can also achieve it with hard
> > clipping/saturation. In the same sense I'd also like to know how a
> > smooth operation works as well. I can not find any source code or
> > explanations to help me figure out the algorithm yet.
> Musicdsp has several examples and you also could take a look at
> Steve's plugins. There are several ways to rectify a signal. The

I wouldn't look at my stuff, I implemented rectification, but its
mathematically ideal (ie. fabs()) or sinus based. If you are looking at
emulating class B amplitification, I think its generally easier to go for
the whole thing, if you really want a working rectifier simualtion, then
you might be able to do it with spice, but IANASU (I Am Not A Spice User).

> hardest way is doing convolution with a matching impulse response. The
> easiest way seems to be waveshaping: There you use a lookup table that
> multiplies your input signal with values that smoothly approach 0 when
> your signal approaches 1.

Yes, but then you have to beware of aliasing, you could probably fix that
with oversampling however.
> > My other question is how are exponential signals generated? I want to
> > experiment with exponential FM. My only understanding of Exp. Fm is that
> > it sweeps half down and full up ( at 440hz, it would sweep 220hz down
> > and 880 hz up). I haven't much of an idea how this is achieved. How do I
> > convert a sine wave into an exponential signal for Exp FM?
> I don't quite understand this. To sweep the frequency, you just apply
> a function on the frequency input. Simplified like
>   out = sin(exp(freq))

#include <exponential-fm-is-pm.rant>

the frequency of an oscilator is given by:

osc_freq = base_freq * pow(2.0, pitch_mod) + freq_mod;

where pitch_mod is the "exponential FM" in octaves, ie +1.0 will shift up
by one octave, eqivalent to the old analogue 1volt/octave system.

- Steve

More information about the Linux-audio-dev mailing list