Can each harmonic have its own envelope in a polynomial waveshaper?
-
- KVRAF
- 2285 posts since 20 Dec, 2002 from The Benighted States of Trumpistan
Amps and such that go clunk when you drop them on a table change the volume and character of an input. After a certain point of greater inputs, harmonics increase but volume doesn't ('cause things have been saturated), as close listening of any distorted guitar shows. I'm working on ways to emulate this, and one of the things I'm working with, is with bounded polynomials. If I can put an envelope with a maximal value, and have enough harmonics, I should get something with a nice dynamic feel.
My basic idea is to use something like exp(x) * x^y, or maybe exp (x^y) for each harmonic. I'd like to use differing envelopes for each harmonic, since the relative ratios of each of the harmonics change with volume in hardware, but that's purely a matter of choosing a differing envelope for each.
Will this work? I can't do or install anything interesting on this particular rig, so I'm kinda programming by implication until I get somewhere civilized.
Anyway, tia.
My basic idea is to use something like exp(x) * x^y, or maybe exp (x^y) for each harmonic. I'd like to use differing envelopes for each harmonic, since the relative ratios of each of the harmonics change with volume in hardware, but that's purely a matter of choosing a differing envelope for each.
Will this work? I can't do or install anything interesting on this particular rig, so I'm kinda programming by implication until I get somewhere civilized.
Anyway, tia.
Wait... loot _then_ burn? D'oh!
-
- KVRAF
- Topic Starter
- 2285 posts since 20 Dec, 2002 from The Benighted States of Trumpistan
And yes, I know, asymmetric clipping with a soft knee might be a better idea -- it'd do most of what I want, and be easier to compute, to boot. But since I'm a n00b, I'm free to follow the crazy stuff. 
Wait... loot _then_ burn? D'oh!
-
- KVRAF
- 6937 posts since 4 Jun, 2004 from Utrecht, Holland
Edit post #1 in the thread, and then you can change the title.
My MusicCalc is temporary offline.
We are the KVR collective. Resistance is futile. You will be assimilated.
We are the KVR collective. Resistance is futile. You will be assimilated.
-
- KVRAF
- Topic Starter
- 2285 posts since 20 Dec, 2002 from The Benighted States of Trumpistan
I may have answered my question. I could divide up the inputs into ranges and adjust multipliers for each harmonic -- say, (0.03 * x^2) in one range, and (0.04 * x^2) in another. Maybe a lookup table of these multipliers. Ideas, suggestions, adulation, donations? 
Wait... loot _then_ burn? D'oh!
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- 4379 posts since 8 Mar, 2004 from Berlin, Germany
i don't really understand that. do you do additive synthesis and then pass the result into a polynomial waveshaper? and if so, what harmonics are you talking about - those that are already present in the input signal or those that are created within the waveshaper?
-
- KVRAF
- Topic Starter
- 2285 posts since 20 Dec, 2002 from The Benighted States of Trumpistan
Nah, it's how the presence of each harmonic raises from a minimum to its maximum in the transfer curve. How strong each harmonic is at low volumes -- perhaps just the first, wit a smidgeon of second and third -- has little to do with the situation at maximum volume, when everything up to maybe the fifteenth harmonic is of equal strength. Each harmonic has its own growth curve, which is analogous to an additive synth.
It's not a matter of a static balance. With real gear, it's never the case that the second harmonic is always twice as strong as the third, regardless of input, or that lower-order harmonics will always be stronger than higher-order -- but digital systems tend to have much less dynamic balances. (I've spent too much time with spectrum analyzers lately!)
So instead of something static like (0.01x^3 + 0.03x), there'd be something like (ax^3 + bx^2 + cx + d), in which a, b, c, and d are all variables of fluctuating values, possibly dependent on x. I'm kinda hoping that I can just substitute, say, "log(x)" for "a" or "sin(x)" for "b"; or perhaps convert "a*(x^3)" to "exp(x^3)." For example, one harmonic could raise in strength linearly, while another goes exponentially, and another inverse logarithmically.
Unfortunately, I suspect that "atan(x*x)" is going to do something other than change the transfer envelope of the second harmonic. I wish I knew more math.
It's not a matter of a static balance. With real gear, it's never the case that the second harmonic is always twice as strong as the third, regardless of input, or that lower-order harmonics will always be stronger than higher-order -- but digital systems tend to have much less dynamic balances. (I've spent too much time with spectrum analyzers lately!)
So instead of something static like (0.01x^3 + 0.03x), there'd be something like (ax^3 + bx^2 + cx + d), in which a, b, c, and d are all variables of fluctuating values, possibly dependent on x. I'm kinda hoping that I can just substitute, say, "log(x)" for "a" or "sin(x)" for "b"; or perhaps convert "a*(x^3)" to "exp(x^3)." For example, one harmonic could raise in strength linearly, while another goes exponentially, and another inverse logarithmically.
Unfortunately, I suspect that "atan(x*x)" is going to do something other than change the transfer envelope of the second harmonic. I wish I knew more math.
Wait... loot _then_ burn? D'oh!
-
- KVRAF
- Topic Starter
- 2285 posts since 20 Dec, 2002 from The Benighted States of Trumpistan
The problem with transfer curves is that changing the curve, changes the sound. I want to find a way to do the one without doing the other.
Wait... loot _then_ burn? D'oh!
-
- KVRian
- 1275 posts since 9 Jan, 2006
Good luck. Changing the curve will alter the harmonic content and will alter the sound.Jafo wrote:The problem with transfer curves is that changing the curve, changes the sound. I want to find a way to do the one without doing the other.
For a kind of additive approach you could look up Chebyshev polynomials. However they only really work for pure sinusoids.
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- 4379 posts since 8 Mar, 2004 from Berlin, Germany
ah, now i understand. as i see it, the problem with your approach is that you are varying the polynomial coefficients with the (instantaneous) signal value x[n] - whereas the strength of the created harmonic depends on the overall amplitude of the incoming sinusoid. in formulas: if your input signal is:Jafo wrote:So instead of something static like (0.01x^3 + 0.03x), there'd be something like (ax^3 + bx^2 + cx + d), in which a, b, c, and d are all variables of fluctuating values, possibly dependent on x. I'm kinda hoping that I can just substitute, say, "log(x)" for "a" or "sin(x)" for "b"; or perhaps convert "a*(x^3)" to "exp(x^3)."
x[n] = A[n] * sin(w*n)
with A[n] being the (possibly time-varying, hence the [n]) amplitude and w being the normalized radian frequency, you'll probably be better off to vary your coeffs depending on A[n] rather than x[n]. of course, if you have some input signal that you don't synthesize yourself, you might have to extract A[n] first (-> envelope follower).
varying polynomial coeffs with the input signal itself actually boils down to changing the transfer function in a static waveshaper
