Re: [PD] a slightly nicer saturator than tanh~

2017-10-28 Thread Chris Clepper
The trick is having a very good anti-aliasing filter just like the FIR in a
high end ADC or SRC or very good mastering processors.  An IIR just won't
work well due to the phase shifting and low order stop band attenuation.  I
don't think Pd has anything built in other than fexpr~ and coefficient
selection is something of a black art to trade off between the attenuation,
taps/delay, transition band, impulse response etc.


On Fri, Oct 27, 2017 at 8:08 PM, Alexandre Torres Porres 
wrote:

>
>
> 2017-10-27 19:12 GMT-02:00 cyrille henry :
>
>> depending on the input you can also LP filter the signal before the
>> distortion.
>>
>> oversampling and filtering is the worst way to deal with aliasing, but
>> sometimes there is no other solution.
>
>
> recently I found out the results were kinda terrible and there wasn't much
> I could do about it, oversampling it to an insane amount like 512x didn't
> improve significantly at all...
>
> so I was wondering: - 1) why? Is there any other way?
>
> You say sometimes "no", but when can you? I assume you could do it better
> if you're designing oscillators and things like that, but for this kind of
> alias generated by digital audio manipulations, maybe there's nothing else
> at all? is that it?
>
> thanks
> cheers
>
> ___
> Pd-list@lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/
> listinfo/pd-list
>
>
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] a slightly nicer saturator than tanh~

2017-10-28 Thread cyrille henry

I don't understand.
can you share your patch?
thanks
c


Le 28/10/2017 à 16:54, Alexandre Torres Porres a écrit :



2017-10-28 11:12 GMT-02:00 cyrille henry >:


So, oversampling by 512 must kill all aliasing.


yeah, but what I found is that it doesn't get that much better than, say 16x


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] a slightly nicer saturator than tanh~

2017-10-28 Thread cyrille henry



Le 28/10/2017 à 14:27, Alexandre Torres Porres a écrit :



2017-10-28 9:51 GMT-02:00 cyrille henry >:


I think added harmonics are : 2, 4, 8, 16...


No, they're all multiples of the fundamental frequency. You can debate wether 
the 1st harmonic or 1st partial is the fundamental, people use this in 
different ways. I see the fundamental as the first partial component and the 
first harmonic on top op that, but usually just consider both as the 
fundamental, so 10th harmonic would be 10Khz (or 11Khz).


yes, sorry, I made a mistake.
if your distortion is symmetrical, it can't produce even harmonics, so added 
harmonics are 3, 5, 7, 9...
see patch or snapshot : the 4th partial of 350Hz is 1500Hz and is not present 
in the distorted sinus.

(if distortion is not symmetrical, then you are right and produce all partial)

So, oversampling by 512 must kill all aliasing.

cheers
c




cheers


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list

#N canvas 149 353 630 513 10;
#X obj 30 99 _disto~;
#X obj 29 253 _fft~;
#X floatatom 49 77 5 0 0 0 - - -, f 5;
#X obj 48 145 oscillo~;
#X msg 534 228 zoom 2;
#X obj 29 49 osc~ 350;
#X connect 0 0 1 0;
#X connect 0 0 3 0;
#X connect 2 0 0 1;
#X connect 4 0 1 1;
#X connect 5 0 0 0;
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] a slightly nicer saturator than tanh~

2017-10-28 Thread Alexandre Torres Porres
2017-10-28 9:51 GMT-02:00 cyrille henry :
>
>
> I think added harmonics are : 2, 4, 8, 16...
>

No, they're all multiples of the fundamental frequency. You can debate
wether the 1st harmonic or 1st partial is the fundamental, people use this
in different ways. I see the fundamental as the first partial component and
the first harmonic on top op that, but usually just consider both as the
fundamental, so 10th harmonic would be 10Khz (or 11Khz).

cheers
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] a slightly nicer saturator than tanh~

2017-10-28 Thread cyrille henry



Le 28/10/2017 à 11:31, Roman Haefeli a écrit :


On Sam, 2017-10-28 at 10:48 +0200, cyrille henry wrote:


Le 28/10/2017 à 02:08, Alexandre Torres Porres a écrit :




2017-10-27 19:12 GMT-02:00 cyrille henry >:

 depending on the input you can also LP filter the signal before
the distortion.

 oversampling and filtering is the worst way to deal with
aliasing, but sometimes there is no other solution.


recently I found out the results were kinda terrible and there
wasn't much I could do about it, oversampling it to an insane
amount like 512x didn't improve significantly at all...

so I was wondering: - 1) why?

if you start with a 1KHz sinuzoid, and add 10 harmonics, the last
harmonics frequency is 1K * 2^10, so about 1MHz


Hm... the tenth harmonic of the fundamental frequency 1kHz is actually
11kHz, not 1MHz, or am I missing something here? 2kHz is the first
partial, 3kHz the second, etc.


I think added harmonics are : 2, 4, 8, 16...




Roman



___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list



___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] a slightly nicer saturator than tanh~

2017-10-28 Thread Roman Haefeli

On Sam, 2017-10-28 at 10:48 +0200, cyrille henry wrote:
> 
> Le 28/10/2017 à 02:08, Alexandre Torres Porres a écrit :
> > 
> > 
> > 
> > 2017-10-27 19:12 GMT-02:00 cyrille henry  > hnry.net>>:
> > 
> > depending on the input you can also LP filter the signal before
> > the distortion.
> > 
> > oversampling and filtering is the worst way to deal with
> > aliasing, but sometimes there is no other solution.
> > 
> > 
> > recently I found out the results were kinda terrible and there
> > wasn't much I could do about it, oversampling it to an insane
> > amount like 512x didn't improve significantly at all...
> > 
> > so I was wondering: - 1) why?
> if you start with a 1KHz sinuzoid, and add 10 harmonics, the last
> harmonics frequency is 1K * 2^10, so about 1MHz

Hm... the tenth harmonic of the fundamental frequency 1kHz is actually
11kHz, not 1MHz, or am I missing something here? 2kHz is the first
partial, 3kHz the second, etc.


Roman 



signature.asc
Description: This is a digitally signed message part
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] a slightly nicer saturator than tanh~

2017-10-28 Thread cyrille henry



Le 28/10/2017 à 02:08, Alexandre Torres Porres a écrit :



2017-10-27 19:12 GMT-02:00 cyrille henry >:

depending on the input you can also LP filter the signal before the 
distortion.

oversampling and filtering is the worst way to deal with aliasing, but 
sometimes there is no other solution.


recently I found out the results were kinda terrible and there wasn't much I 
could do about it, oversampling it to an insane amount like 512x didn't improve 
significantly at all...



so I was wondering: - 1) why?


if you start with a 1KHz sinuzoid, and add 10 harmonics, the last harmonics 
frequency is 1K * 2^10, so about 1MHz
and this is just a "small" distortion
according to what I read on the web, a good oversampling factor is between 2^8 
and 2^14.
 
So, a 512x oversampling is not perfect but should improve a lot. (I suspect a patch problem if you did not have any improvement)



 Is there any other way?

if you don't want to oversample, you must manipulate the sound in a way that 
did not generate harmonics higher that SR/2
this is what antialiased oscillators are doing.



You say sometimes "no", but when can you? I assume you could do it better if 
you're designing oscillators and things like that, but for this kind of alias generated 
by digital audio manipulations, maybe there's nothing else at all? is that it?


I did not find any interesting algorithm searching on the web, but I may have 
missed something.

cheers
c



thanks
cheers


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list



___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] a slightly nicer saturator than tanh~

2017-10-27 Thread Alexandre Torres Porres
2017-10-27 19:12 GMT-02:00 cyrille henry :

> depending on the input you can also LP filter the signal before the
> distortion.
>
> oversampling and filtering is the worst way to deal with aliasing, but
> sometimes there is no other solution.


recently I found out the results were kinda terrible and there wasn't much
I could do about it, oversampling it to an insane amount like 512x didn't
improve significantly at all...

so I was wondering: - 1) why? Is there any other way?

You say sometimes "no", but when can you? I assume you could do it better
if you're designing oscillators and things like that, but for this kind of
alias generated by digital audio manipulations, maybe there's nothing else
at all? is that it?

thanks
cheers
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] a slightly nicer saturator than tanh~

2017-10-27 Thread Miller Puckette
Also try arctangent in place of tanh.  Its asymptotic behavior is
1/x instead of e^(-x) which makes for softer clipping.

I often make a big table to speed up the atan lookup using tabread4~ although
you have to be careful at the table limits.

cheers
Miller

On Fri, Oct 27, 2017 at 11:12:56PM +0200, cyrille henry wrote:
> depending on the input you can also LP filter the signal before the 
> distortion.
> 
> oversampling and filtering is the worst way to deal with aliasing, but 
> sometimes there is no other solution.
> 
> Le 27/10/2017 à 22:03, Matt Davey a écrit :
> > ok yeah, i guess i mean, "nicer" in a way that doesn't alias so bad.
> > 
> > seems oversampling and filtering is the way to go with that, but just 
> > wondering if there's some cheap way to avoid aliasing with distortion, 
> > without oversampling too much?
> 
> ___
> Pd-list@lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> 
> https://lists.puredata.info/listinfo/pd-list

___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] a slightly nicer saturator than tanh~

2017-10-27 Thread cyrille henry

depending on the input you can also LP filter the signal before the distortion.

oversampling and filtering is the worst way to deal with aliasing, but 
sometimes there is no other solution.

Le 27/10/2017 à 22:03, Matt Davey a écrit :

ok yeah, i guess i mean, "nicer" in a way that doesn't alias so bad.

seems oversampling and filtering is the way to go with that, but just wondering 
if there's some cheap way to avoid aliasing with distortion, without 
oversampling too much?


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] a slightly nicer saturator than tanh~

2017-10-27 Thread Matt Davey
ok yeah, i guess i mean, "nicer" in a way that doesn't alias so bad.

seems oversampling and filtering is the way to go with that, but just
wondering if there's some cheap way to avoid aliasing with distortion,
without oversampling too much?
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] a slightly nicer saturator than tanh~

2017-10-27 Thread cyrille henry

hello,
I think "nicer" is really subjective.
tabread4~ is the faster algorithm. (then, put whaterver curve you want in the 
table)
 
you can have a look at nusmuk-audio for different distortion algorithm,

cheers
cyrille


Le 27/10/2017 à 20:37, Matt Davey a écrit :

I'm looking for something with a slightly better saturation character than 
tanh~, but with not much more than about 4 times the CPU usage.  Was thinking 
of just upsampling and filtering tanh~ in a subpatch, but does anyone else have 
a decent saturation algorithm that might be better?


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list



___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


[PD] a slightly nicer saturator than tanh~

2017-10-27 Thread Matt Davey
I'm looking for something with a slightly better saturation character than
tanh~, but with not much more than about 4 times the CPU usage.  Was
thinking of just upsampling and filtering tanh~ in a subpatch, but does
anyone else have a decent saturation algorithm that might be better?
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list