Csound Csound-dev Csound-tekno Search About

[Csnd] "soft clipping"

Date2017-10-28 20:53
FromMichael Mossey
Subject[Csnd] "soft clipping"
I like the soft clipping effect I get with some commercial software synths. I think in some cases they say they are modeling tubes or tape. Does Csound have something similar? Does the "clip" opcode do the same thing?

Mike
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-10-29 01:44
FromEmmett Palaima
SubjectRe: [Csnd] "soft clipping"
Doing a tanh function on your signal is an easy way to create soft clipping, since the output of tanh is essentially a soft clipping transfer function. This is not an opcode per se, but can be done in one line like so:

aclip = tanh(asig) 

or as an input to an opcode, since its simply a math function. 

Another way to do this is via polynomial distortion, as is talked about in this CCRMA article: https://ccrma.stanford.edu/realsimple/faust_strings/Cubic_Nonlinear_Distortion.html

You can easily implement this with the polynomial opcode, and it has the advantage of being very customizable. You will probably want to use clip to hard limit your signal in the range +/- 1 before using this though, as the transfer functions created by polynomials will start to behave different when the input values are no longer fractional. 

Funny you should ask about this now, I've been actively researching the topic recently for one of my projects.

On Sat, Oct 28, 2017 at 3:53 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
I like the soft clipping effect I get with some commercial software synths. I think in some cases they say they are modeling tubes or tape. Does Csound have something similar? Does the "clip" opcode do the same thing?

Mike
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-10-29 07:34
FromMichael Mossey
SubjectRe: [Csnd] "soft clipping"
Thanks. Do you recommend using oversampling when adding distortion, by running a UDO at a higher rate than the orchestra rate? Or is that possible?

Mike

On Sat, Oct 28, 2017 at 6:44 PM, Emmett Palaima <epalaima@berklee.edu> wrote:
Doing a tanh function on your signal is an easy way to create soft clipping, since the output of tanh is essentially a soft clipping transfer function. This is not an opcode per se, but can be done in one line like so:

aclip = tanh(asig) 

or as an input to an opcode, since its simply a math function. 

Another way to do this is via polynomial distortion, as is talked about in this CCRMA article: https://ccrma.stanford.edu/realsimple/faust_strings/Cubic_Nonlinear_Distortion.html

You can easily implement this with the polynomial opcode, and it has the advantage of being very customizable. You will probably want to use clip to hard limit your signal in the range +/- 1 before using this though, as the transfer functions created by polynomials will start to behave different when the input values are no longer fractional. 

Funny you should ask about this now, I've been actively researching the topic recently for one of my projects.

On Sat, Oct 28, 2017 at 3:53 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
I like the soft clipping effect I get with some commercial software synths. I think in some cases they say they are modeling tubes or tape. Does Csound have something similar? Does the "clip" opcode do the same thing?

Mike
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-10-29 16:07
FromEmmett Palaima
SubjectRe: [Csnd] "soft clipping"
I believe what they are talking about is using an oversampling filter after the distortion, in order to band-limit the effect and prevent aliasing that might be caused by the distortion adding harmonics above the nyquist frequency. 

I believe a lot of the csound filter opcodes use oversampling internally (I know moogladder does for example), so you might be able to use those. Perhaps butterlp.

However, think the oversampling is more of something they are recommending to deal with aliasing if it becomes audible, rather than something that is necessary to the effect. At low distortion levels you may not need it at all. 

On Sun, Oct 29, 2017 at 3:35 AM Michael Mossey <michaelmossey@gmail.com> wrote:
Thanks. Do you recommend using oversampling when adding distortion, by running a UDO at a higher rate than the orchestra rate? Or is that possible?

Mike

On Sat, Oct 28, 2017 at 6:44 PM, Emmett Palaima <epalaima@berklee.edu> wrote:
Doing a tanh function on your signal is an easy way to create soft clipping, since the output of tanh is essentially a soft clipping transfer function. This is not an opcode per se, but can be done in one line like so:

aclip = tanh(asig) 

or as an input to an opcode, since its simply a math function. 

Another way to do this is via polynomial distortion, as is talked about in this CCRMA article: https://ccrma.stanford.edu/realsimple/faust_strings/Cubic_Nonlinear_Distortion.html

You can easily implement this with the polynomial opcode, and it has the advantage of being very customizable. You will probably want to use clip to hard limit your signal in the range +/- 1 before using this though, as the transfer functions created by polynomials will start to behave different when the input values are no longer fractional. 

Funny you should ask about this now, I've been actively researching the topic recently for one of my projects.

On Sat, Oct 28, 2017 at 3:53 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
I like the soft clipping effect I get with some commercial software synths. I think in some cases they say they are modeling tubes or tape. Does Csound have something similar? Does the "clip" opcode do the same thing?

Mike
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-10-29 19:50
FromMichael Mossey
SubjectRe: [Csnd] "soft clipping"
Thanks. I suspect I want the oversampling, because I've been playing with distortion effects in the UVI Falcon synth... I love the extra zing and presence that a little distortion adds... actually quite a musically expressive effect. The UVI Falcon distortion effects allow me to select oversampling up to 16x, and it makes a big difference to the pitch definition and the proper quality of harmonic intervals and chords.

Mike


On Sun, Oct 29, 2017 at 9:07 AM, Emmett Palaima <epalaima@berklee.edu> wrote:
I believe what they are talking about is using an oversampling filter after the distortion, in order to band-limit the effect and prevent aliasing that might be caused by the distortion adding harmonics above the nyquist frequency. 

I believe a lot of the csound filter opcodes use oversampling internally (I know moogladder does for example), so you might be able to use those. Perhaps butterlp.

However, think the oversampling is more of something they are recommending to deal with aliasing if it becomes audible, rather than something that is necessary to the effect. At low distortion levels you may not need it at all. 

On Sun, Oct 29, 2017 at 3:35 AM Michael Mossey <michaelmossey@gmail.com> wrote:
Thanks. Do you recommend using oversampling when adding distortion, by running a UDO at a higher rate than the orchestra rate? Or is that possible?

Mike

On Sat, Oct 28, 2017 at 6:44 PM, Emmett Palaima <epalaima@berklee.edu> wrote:
Doing a tanh function on your signal is an easy way to create soft clipping, since the output of tanh is essentially a soft clipping transfer function. This is not an opcode per se, but can be done in one line like so:

aclip = tanh(asig) 

or as an input to an opcode, since its simply a math function. 

Another way to do this is via polynomial distortion, as is talked about in this CCRMA article: https://ccrma.stanford.edu/realsimple/faust_strings/Cubic_Nonlinear_Distortion.html

You can easily implement this with the polynomial opcode, and it has the advantage of being very customizable. You will probably want to use clip to hard limit your signal in the range +/- 1 before using this though, as the transfer functions created by polynomials will start to behave different when the input values are no longer fractional. 

Funny you should ask about this now, I've been actively researching the topic recently for one of my projects.

On Sat, Oct 28, 2017 at 3:53 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
I like the soft clipping effect I get with some commercial software synths. I think in some cases they say they are modeling tubes or tape. Does Csound have something similar? Does the "clip" opcode do the same thing?

Mike
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-10-29 20:24
FromEmmett Palaima
SubjectRe: [Csnd] "soft clipping"
Yes, oversampling the anti-aliasing filter will definitely lead to clearer, less muddy results, especially on harmonically rich content. This is true of any filter: I remember when I first discovered this on the Ableton EQ.

Oversampling the transfer function itself won't do anything, since it is not time based. It simply says given value x as an input you will get value y as an output. 

A filter however is a time based effect, so oversampling can make a big difference. If you want to experiment with oversampling, do so on the filter you use after the distortion transfer function. 

On Sun, Oct 29, 2017 at 3:50 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
Thanks. I suspect I want the oversampling, because I've been playing with distortion effects in the UVI Falcon synth... I love the extra zing and presence that a little distortion adds... actually quite a musically expressive effect. The UVI Falcon distortion effects allow me to select oversampling up to 16x, and it makes a big difference to the pitch definition and the proper quality of harmonic intervals and chords.

Mike


On Sun, Oct 29, 2017 at 9:07 AM, Emmett Palaima <epalaima@berklee.edu> wrote:
I believe what they are talking about is using an oversampling filter after the distortion, in order to band-limit the effect and prevent aliasing that might be caused by the distortion adding harmonics above the nyquist frequency. 

I believe a lot of the csound filter opcodes use oversampling internally (I know moogladder does for example), so you might be able to use those. Perhaps butterlp.

However, think the oversampling is more of something they are recommending to deal with aliasing if it becomes audible, rather than something that is necessary to the effect. At low distortion levels you may not need it at all. 

On Sun, Oct 29, 2017 at 3:35 AM Michael Mossey <michaelmossey@gmail.com> wrote:
Thanks. Do you recommend using oversampling when adding distortion, by running a UDO at a higher rate than the orchestra rate? Or is that possible?

Mike

On Sat, Oct 28, 2017 at 6:44 PM, Emmett Palaima <epalaima@berklee.edu> wrote:
Doing a tanh function on your signal is an easy way to create soft clipping, since the output of tanh is essentially a soft clipping transfer function. This is not an opcode per se, but can be done in one line like so:

aclip = tanh(asig) 

or as an input to an opcode, since its simply a math function. 

Another way to do this is via polynomial distortion, as is talked about in this CCRMA article: https://ccrma.stanford.edu/realsimple/faust_strings/Cubic_Nonlinear_Distortion.html

You can easily implement this with the polynomial opcode, and it has the advantage of being very customizable. You will probably want to use clip to hard limit your signal in the range +/- 1 before using this though, as the transfer functions created by polynomials will start to behave different when the input values are no longer fractional. 

Funny you should ask about this now, I've been actively researching the topic recently for one of my projects.

On Sat, Oct 28, 2017 at 3:53 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
I like the soft clipping effect I get with some commercial software synths. I think in some cases they say they are modeling tubes or tape. Does Csound have something similar? Does the "clip" opcode do the same thing?

Mike
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-10-30 08:50
FromMichael Mossey
SubjectRe: [Csnd] "soft clipping"
That makes sense. I was getting a little careless with terminology, but I see how oversampling the anti-aliasing filter would help. 



Mike
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-10-30 08:58
FromOeyvind Brandtsegg
SubjectRe: [Csnd] "soft clipping"
Just my 2 cents,
I think you have to do the oversampling before the actual distortion, to prevent aliasing appearing due to the added harmonics. Filtering with oversampling after the aliasing has occured won't get rid of the artifacts.

2017-10-29 21:24 GMT+01:00 Emmett Palaima <epalaima@berklee.edu>:
Yes, oversampling the anti-aliasing filter will definitely lead to clearer, less muddy results, especially on harmonically rich content. This is true of any filter: I remember when I first discovered this on the Ableton EQ.

Oversampling the transfer function itself won't do anything, since it is not time based. It simply says given value x as an input you will get value y as an output. 

A filter however is a time based effect, so oversampling can make a big difference. If you want to experiment with oversampling, do so on the filter you use after the distortion transfer function. 

On Sun, Oct 29, 2017 at 3:50 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
Thanks. I suspect I want the oversampling, because I've been playing with distortion effects in the UVI Falcon synth... I love the extra zing and presence that a little distortion adds... actually quite a musically expressive effect. The UVI Falcon distortion effects allow me to select oversampling up to 16x, and it makes a big difference to the pitch definition and the proper quality of harmonic intervals and chords.

Mike


On Sun, Oct 29, 2017 at 9:07 AM, Emmett Palaima <epalaima@berklee.edu> wrote:
I believe what they are talking about is using an oversampling filter after the distortion, in order to band-limit the effect and prevent aliasing that might be caused by the distortion adding harmonics above the nyquist frequency. 

I believe a lot of the csound filter opcodes use oversampling internally (I know moogladder does for example), so you might be able to use those. Perhaps butterlp.

However, think the oversampling is more of something they are recommending to deal with aliasing if it becomes audible, rather than something that is necessary to the effect. At low distortion levels you may not need it at all. 

On Sun, Oct 29, 2017 at 3:35 AM Michael Mossey <michaelmossey@gmail.com> wrote:
Thanks. Do you recommend using oversampling when adding distortion, by running a UDO at a higher rate than the orchestra rate? Or is that possible?

Mike

On Sat, Oct 28, 2017 at 6:44 PM, Emmett Palaima <epalaima@berklee.edu> wrote:
Doing a tanh function on your signal is an easy way to create soft clipping, since the output of tanh is essentially a soft clipping transfer function. This is not an opcode per se, but can be done in one line like so:

aclip = tanh(asig) 

or as an input to an opcode, since its simply a math function. 

Another way to do this is via polynomial distortion, as is talked about in this CCRMA article: https://ccrma.stanford.edu/realsimple/faust_strings/Cubic_Nonlinear_Distortion.html

You can easily implement this with the polynomial opcode, and it has the advantage of being very customizable. You will probably want to use clip to hard limit your signal in the range +/- 1 before using this though, as the transfer functions created by polynomials will start to behave different when the input values are no longer fractional. 

Funny you should ask about this now, I've been actively researching the topic recently for one of my projects.

On Sat, Oct 28, 2017 at 3:53 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
I like the soft clipping effect I get with some commercial software synths. I think in some cases they say they are modeling tubes or tape. Does Csound have something similar? Does the "clip" opcode do the same thing?

Mike
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here



--
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-10-30 15:10
FromEmmett Palaima
SubjectRe: [Csnd] "soft clipping"
Hmm... why would you add the filter prior to the distortion? The input signal is ostensibly already band limited, whereas the distortion is adding a variable amount of harmonic content. The entire issue with aliasing is due to the fact that the added harmonics may be above the nyquist, and this is still the case for a band-limited input signal. 

It makes much more sense to me to have a filter after the distortion to get rid of these frequencies once they are present, rather than attempting to give the transfer function an input which won't create these frequencies.

Is there a reason this is not the case?




On Mon, Oct 30, 2017 at 4:58 AM Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Just my 2 cents,
I think you have to do the oversampling before the actual distortion, to prevent aliasing appearing due to the added harmonics. Filtering with oversampling after the aliasing has occured won't get rid of the artifacts.

2017-10-29 21:24 GMT+01:00 Emmett Palaima <epalaima@berklee.edu>:
Yes, oversampling the anti-aliasing filter will definitely lead to clearer, less muddy results, especially on harmonically rich content. This is true of any filter: I remember when I first discovered this on the Ableton EQ.

Oversampling the transfer function itself won't do anything, since it is not time based. It simply says given value x as an input you will get value y as an output. 

A filter however is a time based effect, so oversampling can make a big difference. If you want to experiment with oversampling, do so on the filter you use after the distortion transfer function. 

On Sun, Oct 29, 2017 at 3:50 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
Thanks. I suspect I want the oversampling, because I've been playing with distortion effects in the UVI Falcon synth... I love the extra zing and presence that a little distortion adds... actually quite a musically expressive effect. The UVI Falcon distortion effects allow me to select oversampling up to 16x, and it makes a big difference to the pitch definition and the proper quality of harmonic intervals and chords.

Mike


On Sun, Oct 29, 2017 at 9:07 AM, Emmett Palaima <epalaima@berklee.edu> wrote:
I believe what they are talking about is using an oversampling filter after the distortion, in order to band-limit the effect and prevent aliasing that might be caused by the distortion adding harmonics above the nyquist frequency. 

I believe a lot of the csound filter opcodes use oversampling internally (I know moogladder does for example), so you might be able to use those. Perhaps butterlp.

However, think the oversampling is more of something they are recommending to deal with aliasing if it becomes audible, rather than something that is necessary to the effect. At low distortion levels you may not need it at all. 

On Sun, Oct 29, 2017 at 3:35 AM Michael Mossey <michaelmossey@gmail.com> wrote:
Thanks. Do you recommend using oversampling when adding distortion, by running a UDO at a higher rate than the orchestra rate? Or is that possible?

Mike

On Sat, Oct 28, 2017 at 6:44 PM, Emmett Palaima <epalaima@berklee.edu> wrote:
Doing a tanh function on your signal is an easy way to create soft clipping, since the output of tanh is essentially a soft clipping transfer function. This is not an opcode per se, but can be done in one line like so:

aclip = tanh(asig) 

or as an input to an opcode, since its simply a math function. 

Another way to do this is via polynomial distortion, as is talked about in this CCRMA article: https://ccrma.stanford.edu/realsimple/faust_strings/Cubic_Nonlinear_Distortion.html

You can easily implement this with the polynomial opcode, and it has the advantage of being very customizable. You will probably want to use clip to hard limit your signal in the range +/- 1 before using this though, as the transfer functions created by polynomials will start to behave different when the input values are no longer fractional. 

Funny you should ask about this now, I've been actively researching the topic recently for one of my projects.

On Sat, Oct 28, 2017 at 3:53 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
I like the soft clipping effect I get with some commercial software synths. I think in some cases they say they are modeling tubes or tape. Does Csound have something similar? Does the "clip" opcode do the same thing?

Mike
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here



Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-10-30 15:18
FromJTG III
SubjectRe: [Csnd] "soft clipping"
I think that means you have to oversample the distortion function itself, then filter before resampling back down to whatever sr you're using, or else the aliasing will be in the signal already by the time you oversample and filter, which will have no effect on any frequencies folded over beneath your antialias filter, making the whole exercise rather ineffective. 

On Oct 30, 2017 11:10 AM, "Emmett Palaima" <epalaima@berklee.edu> wrote:
Hmm... why would you add the filter prior to the distortion? The input signal is ostensibly already band limited, whereas the distortion is adding a variable amount of harmonic content. The entire issue with aliasing is due to the fact that the added harmonics may be above the nyquist, and this is still the case for a band-limited input signal. 

It makes much more sense to me to have a filter after the distortion to get rid of these frequencies once they are present, rather than attempting to give the transfer function an input which won't create these frequencies.

Is there a reason this is not the case?




On Mon, Oct 30, 2017 at 4:58 AM Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Just my 2 cents,
I think you have to do the oversampling before the actual distortion, to prevent aliasing appearing due to the added harmonics. Filtering with oversampling after the aliasing has occured won't get rid of the artifacts.

2017-10-29 21:24 GMT+01:00 Emmett Palaima <epalaima@berklee.edu>:
Yes, oversampling the anti-aliasing filter will definitely lead to clearer, less muddy results, especially on harmonically rich content. This is true of any filter: I remember when I first discovered this on the Ableton EQ.

Oversampling the transfer function itself won't do anything, since it is not time based. It simply says given value x as an input you will get value y as an output. 

A filter however is a time based effect, so oversampling can make a big difference. If you want to experiment with oversampling, do so on the filter you use after the distortion transfer function. 

On Sun, Oct 29, 2017 at 3:50 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
Thanks. I suspect I want the oversampling, because I've been playing with distortion effects in the UVI Falcon synth... I love the extra zing and presence that a little distortion adds... actually quite a musically expressive effect. The UVI Falcon distortion effects allow me to select oversampling up to 16x, and it makes a big difference to the pitch definition and the proper quality of harmonic intervals and chords.

Mike


On Sun, Oct 29, 2017 at 9:07 AM, Emmett Palaima <epalaima@berklee.edu> wrote:
I believe what they are talking about is using an oversampling filter after the distortion, in order to band-limit the effect and prevent aliasing that might be caused by the distortion adding harmonics above the nyquist frequency. 

I believe a lot of the csound filter opcodes use oversampling internally (I know moogladder does for example), so you might be able to use those. Perhaps butterlp.

However, think the oversampling is more of something they are recommending to deal with aliasing if it becomes audible, rather than something that is necessary to the effect. At low distortion levels you may not need it at all. 

On Sun, Oct 29, 2017 at 3:35 AM Michael Mossey <michaelmossey@gmail.com> wrote:
Thanks. Do you recommend using oversampling when adding distortion, by running a UDO at a higher rate than the orchestra rate? Or is that possible?

Mike

On Sat, Oct 28, 2017 at 6:44 PM, Emmett Palaima <epalaima@berklee.edu> wrote:
Doing a tanh function on your signal is an easy way to create soft clipping, since the output of tanh is essentially a soft clipping transfer function. This is not an opcode per se, but can be done in one line like so:

aclip = tanh(asig) 

or as an input to an opcode, since its simply a math function. 

Another way to do this is via polynomial distortion, as is talked about in this CCRMA article: https://ccrma.stanford.edu/realsimple/faust_strings/Cubic_Nonlinear_Distortion.html

You can easily implement this with the polynomial opcode, and it has the advantage of being very customizable. You will probably want to use clip to hard limit your signal in the range +/- 1 before using this though, as the transfer functions created by polynomials will start to behave different when the input values are no longer fractional. 

Funny you should ask about this now, I've been actively researching the topic recently for one of my projects.

On Sat, Oct 28, 2017 at 3:53 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
I like the soft clipping effect I get with some commercial software synths. I think in some cases they say they are modeling tubes or tape. Does Csound have something similar? Does the "clip" opcode do the same thing?

Mike
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here



Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-10-30 18:32
FromOeyvind Brandtsegg
SubjectRe: [Csnd] "soft clipping"
Yes, that was what I meant :-)

2017-10-30 16:18 GMT+01:00 JTG III <jordanthomasgibbonsiii@gmail.com>:
I think that means you have to oversample the distortion function itself, then filter before resampling back down to whatever sr you're using, or else the aliasing will be in the signal already by the time you oversample and filter, which will have no effect on any frequencies folded over beneath your antialias filter, making the whole exercise rather ineffective. 

On Oct 30, 2017 11:10 AM, "Emmett Palaima" <epalaima@berklee.edu> wrote:
Hmm... why would you add the filter prior to the distortion? The input signal is ostensibly already band limited, whereas the distortion is adding a variable amount of harmonic content. The entire issue with aliasing is due to the fact that the added harmonics may be above the nyquist, and this is still the case for a band-limited input signal. 

It makes much more sense to me to have a filter after the distortion to get rid of these frequencies once they are present, rather than attempting to give the transfer function an input which won't create these frequencies.

Is there a reason this is not the case?




On Mon, Oct 30, 2017 at 4:58 AM Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Just my 2 cents,
I think you have to do the oversampling before the actual distortion, to prevent aliasing appearing due to the added harmonics. Filtering with oversampling after the aliasing has occured won't get rid of the artifacts.

2017-10-29 21:24 GMT+01:00 Emmett Palaima <epalaima@berklee.edu>:
Yes, oversampling the anti-aliasing filter will definitely lead to clearer, less muddy results, especially on harmonically rich content. This is true of any filter: I remember when I first discovered this on the Ableton EQ.

Oversampling the transfer function itself won't do anything, since it is not time based. It simply says given value x as an input you will get value y as an output. 

A filter however is a time based effect, so oversampling can make a big difference. If you want to experiment with oversampling, do so on the filter you use after the distortion transfer function. 

On Sun, Oct 29, 2017 at 3:50 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
Thanks. I suspect I want the oversampling, because I've been playing with distortion effects in the UVI Falcon synth... I love the extra zing and presence that a little distortion adds... actually quite a musically expressive effect. The UVI Falcon distortion effects allow me to select oversampling up to 16x, and it makes a big difference to the pitch definition and the proper quality of harmonic intervals and chords.

Mike


On Sun, Oct 29, 2017 at 9:07 AM, Emmett Palaima <epalaima@berklee.edu> wrote:
I believe what they are talking about is using an oversampling filter after the distortion, in order to band-limit the effect and prevent aliasing that might be caused by the distortion adding harmonics above the nyquist frequency. 

I believe a lot of the csound filter opcodes use oversampling internally (I know moogladder does for example), so you might be able to use those. Perhaps butterlp.

However, think the oversampling is more of something they are recommending to deal with aliasing if it becomes audible, rather than something that is necessary to the effect. At low distortion levels you may not need it at all. 

On Sun, Oct 29, 2017 at 3:35 AM Michael Mossey <michaelmossey@gmail.com> wrote:
Thanks. Do you recommend using oversampling when adding distortion, by running a UDO at a higher rate than the orchestra rate? Or is that possible?

Mike

On Sat, Oct 28, 2017 at 6:44 PM, Emmett Palaima <epalaima@berklee.edu> wrote:
Doing a tanh function on your signal is an easy way to create soft clipping, since the output of tanh is essentially a soft clipping transfer function. This is not an opcode per se, but can be done in one line like so:

aclip = tanh(asig) 

or as an input to an opcode, since its simply a math function. 

Another way to do this is via polynomial distortion, as is talked about in this CCRMA article: https://ccrma.stanford.edu/realsimple/faust_strings/Cubic_Nonlinear_Distortion.html

You can easily implement this with the polynomial opcode, and it has the advantage of being very customizable. You will probably want to use clip to hard limit your signal in the range +/- 1 before using this though, as the transfer functions created by polynomials will start to behave different when the input values are no longer fractional. 

Funny you should ask about this now, I've been actively researching the topic recently for one of my projects.

On Sat, Oct 28, 2017 at 3:53 PM, Michael Mossey <michaelmossey@gmail.com> wrote:
I like the soft clipping effect I get with some commercial software synths. I think in some cases they say they are modeling tubes or tape. Does Csound have something similar? Does the "clip" opcode do the same thing?

Mike
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here



Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here



--
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here