I'm messing with chebyshev polynomials for distortion / saturation in synthedit, and although I do get different sounds by controlling drive and the polynomial equation, I'm not too clear as to what exactly is going on. Can anyone recommend a book or some sort of resource that goes over chebyshev polynomials in the context of waveshaping?
I read that you can mix the results of equations of different orders for a particular sound.. What I'm not clear on, is whether all harmonics "up to" the nth order is in the output, or it's "just" the nth harmonic.. I guess I can set up experiments to find out, but still would like to read up a bit more about this.
So far, I'm finding that lower order equations create a buzzy sound that sounds like radio static.. not particularly interesting. Higher order equations start to generate more typical "distorted" sounds.. The waveshaper seems easy to drive, since sending a tiny bit of signal already causes substantial amount of distortion. (so not much subtle drive going on, like in a sin(x/PI) type of transfer function)
Ultimately, I want to make a simple saturator where I can switch between a bunch of different transfer functions.. I could do something like tanh(x) and just use oversampling, but seems like tuning a mixture of chebyshevs would allow for more careful crafting of the sound and also less aliasing.
chebyshev polynomials for waveshaping
Re: chebyshev polynomials for waveshaping
you'd spend a lot less time with real gear...
Re: chebyshev polynomials for waveshaping
ken you still got your scope cards as you really need to get them going in a nice cheap system
- kensuguro
- Posts: 4434
- Joined: Sun Jul 08, 2001 4:00 pm
- Location: BPM 60 to somewhere around 150
- Contact:
Re: chebyshev polynomials for waveshaping
after messing with it some more today I still ended up with something that sounds like a broken radio. I mean, it has a very specific effect.. just not sure what I'd use it for. It's a type of distortion I've heard before, usually called "distortion" rather than "overdrive" or "saturation".. It sounds kiiind of like a totally trashed video, but a bit too trashed. I'm kind of bummed at the result to be honest.
Uses the 11th chebyshev polynomial 1024x^11 − 2816x^9 + 2816x^7 − 1232x^5 + 220x^3 − 11x. No magic or mystery there.
I did find that for whatever reason, polynomials of odd power can be driven like you'd expect to drive a distortion unit (with input amplitude) but the even powered ones get fully distorted with any tiny amount of drive. I have no idea why.. so decided to not mess with the even powered equations.
Controls are fairly self explanatory, "drive" is the amplitude of the signal that goes into the waveshaper, and "gain" comes after that (0-1 though, so not amp, just attenuating). There's a selector to audition source or output signal (used for sanity check). The two tiny dropdown are test features of the new Synthedit version, that does oversampling and also associated filtering. And scope's there just so I could make sure it's doing something.
I can make a version that exposes the waveshaper so you can punch in your own equations if anyone's interested. Wow, just noticed the dll is close to 2 mb zipped! Surprised 2 waveshapers and a couple of knobs can get that big.
Uses the 11th chebyshev polynomial 1024x^11 − 2816x^9 + 2816x^7 − 1232x^5 + 220x^3 − 11x. No magic or mystery there.
I did find that for whatever reason, polynomials of odd power can be driven like you'd expect to drive a distortion unit (with input amplitude) but the even powered ones get fully distorted with any tiny amount of drive. I have no idea why.. so decided to not mess with the even powered equations.
Controls are fairly self explanatory, "drive" is the amplitude of the signal that goes into the waveshaper, and "gain" comes after that (0-1 though, so not amp, just attenuating). There's a selector to audition source or output signal (used for sanity check). The two tiny dropdown are test features of the new Synthedit version, that does oversampling and also associated filtering. And scope's there just so I could make sure it's doing something.
I can make a version that exposes the waveshaper so you can punch in your own equations if anyone's interested. Wow, just noticed the dll is close to 2 mb zipped! Surprised 2 waveshapers and a couple of knobs can get that big.
- Attachments
-
- chebsat.zip
- (1.98 MiB) Downloaded 82 times
- kensuguro
- Posts: 4434
- Joined: Sun Jul 08, 2001 4:00 pm
- Location: BPM 60 to somewhere around 150
- Contact:
Re: chebyshev polynomials for waveshaping
I'm moving on to looking at slew behavior to mimic bad speakers. So limiting the time unit delta. Not sure how it's going to turn out.. I'd assume it'll just make things sound muddy.
- Nestor
- Posts: 6688
- Joined: Tue Mar 27, 2001 4:00 pm
- Location: Fourth Dimension Paradise, Cloud Nine!
Re: chebyshev polynomials for waveshaping
My friend Ken, I don't want to put you down with your endeavor, but you could do it easily with my second pair of speakers
Just a joke, keep learning my restless brother 


*MUSIC* The most Powerful Language in the world! *INDEED*
- kensuguro
- Posts: 4434
- Joined: Sun Jul 08, 2001 4:00 pm
- Location: BPM 60 to somewhere around 150
- Contact:
Re: chebyshev polynomials for waveshaping
hah, I finally figured out how to do slew control. I was having a hard time trying to grab a previous sample using sample and hold and a bunch of logic gates, but I found a math expression module that accepted multiline statements.. so essentially it was like programming, with exact control over execution order.
To control slew, I turned the position into a relative position, and moved it around with delta:
delta = current sample - prev sample;
current value = prev sample + delta * fader;
prev sample = current value;
Essentially like how I'd move objects around in a game using euler integration every frame. From an euler prespective, this is just measuring inter frame velocity and then limiting that to cause a bit of a "lag". If I did this on a mouse drag, the object would lag slightly behind (smoothly), and when your mouse stops, the object would smoothly ease to the position. Same thing with the audio voltage.
That's the how. The resulting sound is like a low pass filter if 0<fader<1. Above 1, it sounds like it adds high end, until the fader reaches 2, at which point the whole circuit dies and shuts down. So I've limited the fader range to 0 - 1.999. The oversample controls are in there too since going above 1 will start introducing extra harmonics and aliasing. You can hear the effect more with oversample off, but it's also lots of smearing and crunchiness. Mainly, i think this can be used at 0.3~1.0 range to mellow out an otherwise too treble hot digital crunchy mix. If applied subtly, I think it can take just the right amount of edge off, but in a different way than an eq. With the added benefit of not having your needle fly off the LP if you're pressing vinyl I guess.
I think slowing down the slew is interesting, but increasing the delta and artificially pumping up the slew speed is more interesting. It's sad I can't go past 2.. I need to figure out how to supercharge this so it can make everything super hot and crunchy. It's not the most ground breaking of all concepts, but I think it's cool because it fundamentally changes how the audio voltage signal behaves.
BTW, I also read that slew rate is also a problem for some CD playback systems. When the amplitude delta is too much, it causes some sort of noise in the amp since it can't keep up... So I guess cranking up the delta isn't exactly an amp friendly idea.. But I guess it's still cool to be able to create the signal of death.
An interesting variation may be an amplitude dependent displacement. The softer the sound, the more delta it gets, and the louder the sound, the more it's left alone. In effect that's be like an expander, but instead of increasing amplitude below a threshold, it'd just increase the delta or the jaggedness, and as a result drive up the upper harmonics of that range. So softer sounds have more harmonics than loud? not sure what that'd even sound like. I guess it'd sound interesting with things like reverb tails, preserving lots of detail as the tail gets softer.
[edit]
I tested making the slew amount be delta dependent, and it seems like this concept has some legs. Basically, the more delta (usually transients), the more smoothing is applied.. which is kind of like a compressor, except it's applied on delta. This would be a step above applying slew limiting across the board at a constant rate, so it's applied more as needed. The inverse of this would be applying more delta on the transients, which may be more useful than smoothing them.
To control slew, I turned the position into a relative position, and moved it around with delta:
delta = current sample - prev sample;
current value = prev sample + delta * fader;
prev sample = current value;
Essentially like how I'd move objects around in a game using euler integration every frame. From an euler prespective, this is just measuring inter frame velocity and then limiting that to cause a bit of a "lag". If I did this on a mouse drag, the object would lag slightly behind (smoothly), and when your mouse stops, the object would smoothly ease to the position. Same thing with the audio voltage.
That's the how. The resulting sound is like a low pass filter if 0<fader<1. Above 1, it sounds like it adds high end, until the fader reaches 2, at which point the whole circuit dies and shuts down. So I've limited the fader range to 0 - 1.999. The oversample controls are in there too since going above 1 will start introducing extra harmonics and aliasing. You can hear the effect more with oversample off, but it's also lots of smearing and crunchiness. Mainly, i think this can be used at 0.3~1.0 range to mellow out an otherwise too treble hot digital crunchy mix. If applied subtly, I think it can take just the right amount of edge off, but in a different way than an eq. With the added benefit of not having your needle fly off the LP if you're pressing vinyl I guess.
I think slowing down the slew is interesting, but increasing the delta and artificially pumping up the slew speed is more interesting. It's sad I can't go past 2.. I need to figure out how to supercharge this so it can make everything super hot and crunchy. It's not the most ground breaking of all concepts, but I think it's cool because it fundamentally changes how the audio voltage signal behaves.
BTW, I also read that slew rate is also a problem for some CD playback systems. When the amplitude delta is too much, it causes some sort of noise in the amp since it can't keep up... So I guess cranking up the delta isn't exactly an amp friendly idea.. But I guess it's still cool to be able to create the signal of death.
An interesting variation may be an amplitude dependent displacement. The softer the sound, the more delta it gets, and the louder the sound, the more it's left alone. In effect that's be like an expander, but instead of increasing amplitude below a threshold, it'd just increase the delta or the jaggedness, and as a result drive up the upper harmonics of that range. So softer sounds have more harmonics than loud? not sure what that'd even sound like. I guess it'd sound interesting with things like reverb tails, preserving lots of detail as the tail gets softer.
[edit]
I tested making the slew amount be delta dependent, and it seems like this concept has some legs. Basically, the more delta (usually transients), the more smoothing is applied.. which is kind of like a compressor, except it's applied on delta. This would be a step above applying slew limiting across the board at a constant rate, so it's applied more as needed. The inverse of this would be applying more delta on the transients, which may be more useful than smoothing them.
- Attachments
-
- slewcontrol.zip
- (1.89 MiB) Downloaded 65 times
- Roland Kuit
- Posts: 670
- Joined: Fri Dec 28, 2012 1:42 pm
- Location: NL/SWE
- Contact:
Re: chebyshev polynomials for waveshaping
Hi Ken,
I only can give you this Kyma answer atm. Hopefully it adds something for you.
This is what Kyma says:
Waveshaper
The Input is used as an index into the table specified in ShapingFunction (if ShapeFrom is set to Wavetable) or as the input to a polynomial whose coefficients are those listed in the Coefficients parameter field (if ShapeFrom is set to Polynomial).
Unless the ShapingFunction or polynomial is a straight line, the Input will be nonlinearly distorted. The distortion adds harmonics to the synthesized or sampled Input. Since polynomials tend to be close to linear around zero and less linear the further they are from zero, low amplitude Inputs will be less distorted than high amplitude Inputs. This tends to match the behavior of physical instruments (which sound "brighter" when played louder) and also of electronic components like amplifiers which produce harmonic distortions of their inputs at high amplitudes.
A Waveshaper can also be used to map non-signal Inputs to new values according to the ShapingFunction or polynomial. For example, if the Input were a Constant whose Value were !Pitch, the full range of MIDI notenumbers could be remapped by a Waveshaper to frequencies of an alternate tuning system as stored in a table (the ShapingFunction).
Input
This Sound is used as an index into the ShapingFunction (or as the input into the polynomial described the list of Coefficients).
Interpolation
Choose whether to use only integer values to index into the ShapingFunction or whether to use the fractional part of the Input value to interpolate between the values actually stored in the table to values that would fall "inbetween" the table entries if the actual values were connected by a straight line.
ShapeFrom
Choose whether to use a function stored in a table (Wavetable) or a polynomial computed on the fly using the Coefficients (Polynomial).
ShapingFunction
Select the wavetable that will be used to map the Input to the output.
Coefficients
Enter a list of coefficients A0 A1 A2 ... An (separated by spaces) for a polynomial of the form:
A0 + A1x + A2x^2 + A3x^3 + ... + Anx^n
where Input is x.
In this field, you must enclose expressions within curly braces, for example:
0 {!Val1 * !KeyVelocity} 0.25 1
FromMemoryWriter
Check FromMemoryWriter when the shaping function does not come from a disk file but is recorded by a MemoryWriter in real time.
I only can give you this Kyma answer atm. Hopefully it adds something for you.
This is what Kyma says:
Waveshaper
The Input is used as an index into the table specified in ShapingFunction (if ShapeFrom is set to Wavetable) or as the input to a polynomial whose coefficients are those listed in the Coefficients parameter field (if ShapeFrom is set to Polynomial).
Unless the ShapingFunction or polynomial is a straight line, the Input will be nonlinearly distorted. The distortion adds harmonics to the synthesized or sampled Input. Since polynomials tend to be close to linear around zero and less linear the further they are from zero, low amplitude Inputs will be less distorted than high amplitude Inputs. This tends to match the behavior of physical instruments (which sound "brighter" when played louder) and also of electronic components like amplifiers which produce harmonic distortions of their inputs at high amplitudes.
A Waveshaper can also be used to map non-signal Inputs to new values according to the ShapingFunction or polynomial. For example, if the Input were a Constant whose Value were !Pitch, the full range of MIDI notenumbers could be remapped by a Waveshaper to frequencies of an alternate tuning system as stored in a table (the ShapingFunction).
Input
This Sound is used as an index into the ShapingFunction (or as the input into the polynomial described the list of Coefficients).
Interpolation
Choose whether to use only integer values to index into the ShapingFunction or whether to use the fractional part of the Input value to interpolate between the values actually stored in the table to values that would fall "inbetween" the table entries if the actual values were connected by a straight line.
ShapeFrom
Choose whether to use a function stored in a table (Wavetable) or a polynomial computed on the fly using the Coefficients (Polynomial).
ShapingFunction
Select the wavetable that will be used to map the Input to the output.
Coefficients
Enter a list of coefficients A0 A1 A2 ... An (separated by spaces) for a polynomial of the form:
A0 + A1x + A2x^2 + A3x^3 + ... + Anx^n
where Input is x.
In this field, you must enclose expressions within curly braces, for example:
0 {!Val1 * !KeyVelocity} 0.25 1
FromMemoryWriter
Check FromMemoryWriter when the shaping function does not come from a disk file but is recorded by a MemoryWriter in real time.
- Attachments
-
- Wveshaper - polynormal.jpg (51.81 KiB) Viewed 1798 times
Avant-electronic composer | synthesis research | lecturer
http://www.rolandkuit.com/
http://www.rolandkuit.com/
- kensuguro
- Posts: 4434
- Joined: Sun Jul 08, 2001 4:00 pm
- Location: BPM 60 to somewhere around 150
- Contact:
Re: chebyshev polynomials for waveshaping
thanks Roland, cool to see the actual screens. I'm curious how Kyma handles aliasing
- Roland Kuit
- Posts: 670
- Joined: Fri Dec 28, 2012 1:42 pm
- Location: NL/SWE
- Contact:
Re: chebyshev polynomials for waveshaping
Kensuguru, one way is the use of a wavetable bandlimiter.
Avant-electronic composer | synthesis research | lecturer
http://www.rolandkuit.com/
http://www.rolandkuit.com/