Re: [linux-audio-dev] Diode wave shaper (LADSPA plugin)?

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] Diode wave shaper (LADSPA plugin)?
From: Alfons Adriaensen (fons.adriaensen_AT_alcatel.be)
Date: Mon Aug 16 2004 - 13:13:51 EEST


On Mon, Aug 16, 2004 at 07:49:36PM +1000, Erik de Castro Lopo wrote:

> Its actually rather simple (first year EE):
>
> static inline double
> diode_clip (double input, double clip_level /* should be positive */)
> { if (input > clip_level)
> return clip_level ;
> if (input < -clip_level)
> return clip_level ;
> return input ;
> }

This is a bit too simple. The diode circuit does not perform hard
clipping when driven at moderate levels.

Something like

  out = tanh (in) (or tanhf() if available)

or

  out = in / sqrt (1 + in * in)

with some scaling of in and out will come very close
to the real behaviour. Alternatively change the '1' in
the sqrt to some other constant to set the normal
operation levels.

-- 
FA


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Aug 16 2004 - 13:18:35 EEST