[sdiy] tanh() and approximations and warping, why is my maths wrong?

Andrew Simper andy at cytomic.com
Tue Jun 11 08:04:33 CEST 2019

The pre-warping of the cutoff for a digital filter (ie mapping cutoff to
gain factors needed to compute the filter) depend on the digital filter
structure being used, not the non-linearities in the filter structure.
Typically the non-linearities will cause a small change in the cutoff,
either upwards on downwards depending on the shape of the non-linearities,
but just on self oscillation they won't make much difference.

On Tue, 11 Jun 2019 at 12:58, Brian Willoughby <brianw at audiobanshee.com>

> On Jun 10, 2019, at 1:58 PM, Gordonjcp <gordonjcp at gjcp.net> wrote:
> > On Mon, Jun 10, 2019 at 09:11:58PM +0100, Tom Wiltshire wrote:
> >> I think what he’s looking for is to know why x/(1+x) gives the right
> warping to get the correct cutoff frequency.
> >>
> >> Since I know very little of how digital filter models are derived from
> their analog counterparts and the approximations inherent in that process,
> I’m not the person to ask…
> >>
> >> Tom
> >
> > That's it exactly.  I'm not great at maths and the kind of algebra that
> > goes into this sort of thing is a bit much for me, but x/(1+x) gets the
> > filter tracking absolutely bang on.
> Matthias hinted at the compete answer. There are series, like the Taylor
> series or Maclaurin series, where each additional term gets closer to a
> correct estimation of the actual function value. Since each additional term
> costs CPU time, the normal practice is to decide the tradeoff between
> accuracy and time for your range of values needed and processing power. The
> assumption is that calculating the precise function value is way too
> expensive, so the approximation is taken as close as is practical.
> The Taylor series for tanh(x) = x - (x^3)/3 + 2(x^5)/15 - 17(x^7)/315 + ...
> Since digital audio is only valid up to Nyquist, you only need the
> approximation to be accurate up to 0.5, and it looks like the first three
> terms are very accurate up to 0.5 Fs, and then it only slowly drifts away
> until well above 0.75 Fs. Even just the first two terms stay fairly close
> up to 0.5 Fs, so all you really need is:
> y = x - x^3/3
> An equation like x/(1 + x) doesn’t seem to fit that very closely. Maybe
> it’s a different series? Graphing x/(1+x) shows it to be well off tanh(x),
> so I’m not sure why you’re getting good results. It’s roughly 2/3 of
> tanh(x), so maybe you have some scaling?
> Brian
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://synth-diy.org/pipermail/synth-diy/attachments/20190611/00c05b9e/attachment.htm>

More information about the Synth-diy mailing list