[yoshimi] Re: Hyperbolic Secant Waveform

  • From: Will Godfrey <willgodfrey@xxxxxxxxxxxxxxx>
  • To: yoshimi@xxxxxxxxxxxxx
  • Date: Sun, 20 Oct 2019 20:42:40 +0100

On Sat, 19 Oct 2019 22:03:03 +0200
Thomas Mitterfellner <thomas.mitterfellner@xxxxxxxxx> wrote:

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

That's quite interesting. To my ears the difference from Gaussian can be quite
subtle. If there was enough interest it would be easy enough to add this to the
end of the Base Func list. Older versions of Yoshimi would just see the
numeric value as default sine wave.

-- 
Will J Godfrey
http://www.musically.me.uk
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.
Yoshimi source code is available from either: 
https://sourceforge.net/projects/yoshimi
Or: https://github.com/Yoshimi/yoshimi
Our list archive is at: https://www.freelists.org/archive/yoshimi
To post, email to yoshimi@xxxxxxxxxxxxx

Other related posts: