[yoshimi] Hyperbolic Secant Waveform

  • From: Thomas Mitterfellner <thomas.mitterfellner@xxxxxxxxx>
  • To: yoshimi@xxxxxxxxxxxxx
  • Date: Sat, 19 Oct 2019 22:03:03 +0200

Hello there!

Recently at work I had to do with the hyperbolic secant function
(sech(x) = 1/cosh(x)), which when plotted looks similar to a gaussian
function, (especially its square
https://www.rp-photonics.com/sech2_shaped_pulses.html) but with subtle
differences, namely stronger wings.

I had yoshimi's AddSynth in the back of my head and I wondered what
functions of this type sound like, especially when compared to the
Gaussian function. So I quickly hacked this function into the code (I
just replaced the basefunc_abssine so I wouldn't have to change the GUI
code, but below I renamed the function).

Generally speaking, the HypSec function sounds somewhat brighter than
the Gaussian function. The harmonic structure of its fundamental looks
interesting (to me): for parameters beween ~-16–63, it seems to be
linearly decreasing, while for parameters between -64–-15, it looks like
it's parabolically decreasing (if the attachment goes through: see
attachment).

I thought I'd share this little experiment with the mailing list.

float OscilGen::basefunc_hypsec(float x, float a)
{
    x = (fmodf(x, 1.0f) - 0.5f) * expf(1.2f * (a - 0.2f) * logf(128.0f));

    return 1.0f/coshf(x * PI);
}

Greetings,
Thomas

Attachment: hypsecant.png
Description: PNG image

Other related posts: