Thanks Claudio,

that looks like a good implementation as well!

best, P

* claudio nervi <[email protected]> [2025-12-15 16:22]:
> Peter:
> 
> I replace tanh~ with un Euler approximation of  2.71828 : tanh(x)=(e^x -
> e^-x) / (e^x + e^-x)
> I'm not sure if it's ok, but it works:
> 
> #N canvas 224 224 483 354 12;
> #X obj 75 167 pow~;
> #X obj 75 98 sig~ 2.71828;
> #X obj 75 232 -~;
> #X obj 144 140 *~ -1;
> #X obj 123 167 pow~;
> #X obj 108 231 +~;
> #X obj 75 273 /~;
> #X obj 99 46 inlet~;
> #X obj 75 307 outlet~;
> #X text 114 15 tanh(x)=(e^x - e^-x) / (e^x + e^-x);
> #X text 201 100 euler;
> #X connect 0 0 2 0;
> #X connect 0 0 5 0;
> #X connect 1 0 0 0;
> #X connect 1 0 4 0;
> #X connect 2 0 6 0;
> #X connect 3 0 4 1;
> #X connect 4 0 2 1;
> #X connect 4 0 5 1;
> #X connect 5 0 6 1;
> #X connect 6 0 8 0;
> #X connect 7 0 0 1;
> #X connect 7 0 3 0;
> 
> Claudio.
> 
> 
> 
> El jue, 11 dic 2025 a las 17:31, <[email protected]> escribió:
> 
> > Send Pd-list mailing list submissions to
> >         [email protected]
> >
> > To subscribe or unsubscribe via email, send a message with subject or
> > body 'help' to
> >         [email protected]
> >
> > You can reach the person managing the list at
> >         [email protected]
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of Pd-list digest..."
> >
> > Today's Topics:
> >
> >    1. tanh~ distortion without expr~? (Peter P.)
> >    2. Re: tanh~ distortion without expr~? (cyrille henry)
> >    3. Re: tanh~ distortion without expr~? (Peter P.)
> >    4. Re: tanh~ distortion without expr~? (Simon Iten)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Thu, 11 Dec 2025 12:01:41 +0100
> > From: "Peter P." <[email protected]>
> > Subject: [PD] tanh~ distortion without expr~?
> > To: pd-list <[email protected]>
> > Message-ID:
> >         <hebj2lz6dhgl27j5az7tgohuiyfrlqwaily5ajdfbdy3rkkwzp@63oldhy2nqvh>
> > Content-Type: text/plain; charset=us-ascii
> >
> > Hi,
> >
> > is there a vanilla way to implement tanh~ distortion without using expr~?
> >
> > Thanks!
> > P
> >
> >
> > ------------------------------
> >
> > Message: 2
> > Date: Thu, 11 Dec 2025 12:11:16 +0100
> > From: cyrille henry <[email protected]>
> > Subject: [PD] Re: tanh~ distortion without expr~?
> > To: <[email protected]>
> > Message-ID: <[email protected]>
> > Content-Type: text/plain; charset="UTF-8"; format=flowed
> >
> > hello,
> >
> > For a distortion, you can use f(x) = x*(27 + x²) / (27 + 9*x²) as a good
> > enough tanh approximation. (x need to be clipped between -3 and 3)
> > https://www.desmos.com/calculator/dxg70xbtne?lang=fr
> >
> > Cheers
> > C
> >
> >
> >
> > Le 11/12/2025 à 12:01, Peter P. a écrit :
> > > Hi,
> > >
> > > is there a vanilla way to implement tanh~ distortion without using expr~?
> > >
> > > Thanks!
> > > P
> > >
> > > ---
> > > [email protected] - the Pure Data mailinglist
> > >
> > https://lists.iem.at/hyperkitty/list/[email protected]/message/WDXKOYLK6LF5XN2UFMODWREXAV2MIQR3/
> > >
> > > To unsubscribe send an email to [email protected] mailing list
> > > UNSUBSCRIBE and account-management -> https://lists.iem.at/
> > >
> >
> >
> >
> > ------------------------------
> >
> > Message: 3
> > Date: Thu, 11 Dec 2025 12:35:45 +0100
> > From: "Peter P." <[email protected]>
> > Subject: [PD] Re: tanh~ distortion without expr~?
> > To: [email protected]
> > Message-ID:
> >         <lkqildo72aqe6hikykbru7ahdtl5soz3foueyr33gh62pqfjxp@gl4zvkgw7d5z>
> > Content-Type: text/plain; charset=iso-8859-1
> >
> > Wow, quick and neat -merci bien Cyrille!
> > P
> >
> > * cyrille henry <[email protected]> [2025-12-11 12:11]:
> > > hello,
> > >
> > > For a distortion, you can use f(x) = x*(27 + x²) / (27 + 9*x²) as a good
> > enough tanh approximation. (x need to be clipped between -3 and 3)
> > > https://www.desmos.com/calculator/dxg70xbtne?lang=fr
> > >
> > > Cheers
> > > C
> > >
> > >
> > >
> > > Le 11/12/2025 à 12:01, Peter P. a écrit :
> > > > Hi,
> > > >
> > > > is there a vanilla way to implement tanh~ distortion without using
> > expr~?
> > > >
> > > > Thanks!
> > > > P
> > > >
> > > > ---
> > > > [email protected] - the Pure Data mailinglist
> > > >
> > https://lists.iem.at/hyperkitty/list/[email protected]/message/WDXKOYLK6LF5XN2UFMODWREXAV2MIQR3/
> > > >
> > > > To unsubscribe send an email to [email protected] mailing
> > list
> > > > UNSUBSCRIBE and account-management -> https://lists.iem.at/
> > > >
> > >
> > >
> > > ---
> > > [email protected] - the Pure Data mailinglist
> > >
> > https://lists.iem.at/hyperkitty/list/[email protected]/message/X3SMOHZDQUF73N3ZHQIUQ45NQWOR45ZR/
> > >
> > > To unsubscribe send an email to [email protected] mailing list
> > > UNSUBSCRIBE and account-management -> https://lists.iem.at/
> >
> >
> > ------------------------------
> >
> > Message: 4
> > Date: Thu, 11 Dec 2025 17:30:53 +0100
> > From: Simon Iten <[email protected]>
> > Subject: [PD] Re: tanh~ distortion without expr~?
> > To: [email protected]
> > Message-ID: <[email protected]>
> > Content-Type: multipart/mixed;
> >         boundary="Apple-Mail=_5EB4542B-EC40-47A5-A970-5F89EAC38A10"
> >
> > Yep, this works great!! Here is the implementation and another one, that
> > is also quite nice…
> >
> > (It is a patch to be compiled with heavy, but you get the idea)
> >
> > -------------- next part --------------
> > A message part incompatible with plain text digests has been removed ...
> > Name: fx_slot1.pd
> > Type: application/octet-stream
> > Size: 21920 bytes
> > Desc: not available
> > -------------- next part --------------
> >
> >
> >
> > > Am 11.12.2025 um 12:35 schrieb Peter P. <[email protected]>:
> > >
> > > Wow, quick and neat -merci bien Cyrille!
> > > P
> > >
> > > * cyrille henry <[email protected]> [2025-12-11 12:11]:
> > >> hello,
> > >>
> > >> For a distortion, you can use f(x) = x*(27 + x²) / (27 + 9*x²) as a
> > good enough tanh approximation. (x need to be clipped between -3 and 3)
> > >> https://www.desmos.com/calculator/dxg70xbtne?lang=fr
> > >>
> > >> Cheers
> > >> C
> > >>
> > >>
> > >>
> > >> Le 11/12/2025 à 12:01, Peter P. a écrit :
> > >>> Hi,
> > >>>
> > >>> is there a vanilla way to implement tanh~ distortion without using
> > expr~?
> > >>>
> > >>> Thanks!
> > >>> P
> > >>>
> > >>> ---
> > >>> [email protected] - the Pure Data mailinglist
> > >>>
> > https://lists.iem.at/hyperkitty/list/[email protected]/message/WDXKOYLK6LF5XN2UFMODWREXAV2MIQR3/
> > >>>
> > >>> To unsubscribe send an email to [email protected] mailing
> > list
> > >>> UNSUBSCRIBE and account-management -> https://lists.iem.at/
> > >>>
> > >>
> > >>
> > >> ---
> > >> [email protected] - the Pure Data mailinglist
> > >>
> > https://lists.iem.at/hyperkitty/list/[email protected]/message/X3SMOHZDQUF73N3ZHQIUQ45NQWOR45ZR/
> > >>
> > >> To unsubscribe send an email to [email protected] mailing list
> > >> UNSUBSCRIBE and account-management -> https://lists.iem.at/
> > >
> > > ---
> > > [email protected] - the Pure Data mailinglist
> > >
> > https://lists.iem.at/hyperkitty/list/[email protected]/message/QWFI7EJH5BRAA7HGHPZKWITDBWIIDPXW/
> > >
> > > To unsubscribe send an email to [email protected] mailing list
> > > UNSUBSCRIBE and account-management -> https://lists.iem.at/
> > >
> >
> >
> > ------------------------------
> >
> > Subject: Digest Footer
> >
> > _______________________________________________
> > Pd-list mailing list -- [email protected]
> > To unsubscribe send an email to [email protected]
> > to manage your subscription (including un-subscription) see
> >
> >
> > ------------------------------
> >
> > End of Pd-list Digest, Vol 249, Issue 7
> > ***************************************
> >

> ---
> [email protected] - the Pure Data mailinglist
> https://lists.iem.at/hyperkitty/list/[email protected]/message/H3IMLOPPOR3OINNGY43O2YVVE55I7YN3/
> 
> To unsubscribe send an email to [email protected] mailing list
> UNSUBSCRIBE and account-management -> https://lists.iem.at/


---
[email protected] - the Pure Data mailinglist
https://lists.iem.at/hyperkitty/list/[email protected]/message/LTKDCY5ZNG6MBJ23A45UFZROV2LBG5DX/

To unsubscribe send an email to [email protected] mailing list
UNSUBSCRIBE and account-management -> https://lists.iem.at/

Reply via email to