How does a dynamic eq work?
- KVRAF
- 12555 posts since 7 Dec, 2004
He also suggested linear with adaptive frequency though. So this would be identical to a log filter (RC) only without any curvature.
You could also use polynomials or cubic splines or so on to create an Nth order curve between the points just as you could use an Nth order filter (RC) to do the same.
In fact you can replace the linear section between two points with the exact curve to match log, as well as any curve. It is just far less efficient which is really what makes a lossy integrator the best choice.
Two pole filters tend to make better envelope followers with reasonable Q, approximately 1/2. This allows reasonable attack at the same time as only moderate overshoot with excellent rejection of high frequencies and low computational cost.
Linear as you're using it camsr is better referred to as "constant delta" or "slew limiting" or "fixed slew" while I think he is using linear simply to refer to the curve, that is = first order.
You could also use polynomials or cubic splines or so on to create an Nth order curve between the points just as you could use an Nth order filter (RC) to do the same.
In fact you can replace the linear section between two points with the exact curve to match log, as well as any curve. It is just far less efficient which is really what makes a lossy integrator the best choice.
Two pole filters tend to make better envelope followers with reasonable Q, approximately 1/2. This allows reasonable attack at the same time as only moderate overshoot with excellent rejection of high frequencies and low computational cost.
Linear as you're using it camsr is better referred to as "constant delta" or "slew limiting" or "fixed slew" while I think he is using linear simply to refer to the curve, that is = first order.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
-
- KVRAF
- 3080 posts since 17 Apr, 2005 from S.E. TN
Thanks for the good ideas, miles, camsr, aciddose. Yah, I know the 63%TC curve is same as RC. It may very well be that this behavior is "god's envelope follower" and the best choice. The curve is observed in many natural systems. It is simple and easy/fast to implement.
Been a few years since I made a dynamics processor, just been thinking about it lately. I don't recall using any other shape of smoother on old analog homebrew compressors or later software dynamics processors.
In several old analog circuits and in digital dynamics, I used multiple series or parallel RC smoothers. As aciddose says, perhaps a carefully chosen Q on a higher order filter would be better still. With series first order sections at least you don't have to worry about overshoot. For instance, two series first order smoothers is "similar" to a second order bessel. Just slightly droopier.
In the past I'd see messages about other smoother shapes, and be skeptical. However have never tried other shapes so dunno whether some other shape might have advantages. Maybe I should try a few different shapes just to find out what happens.
For instance, to hear some folks tell it, linear crossfades are more perverted than marrying a chicken. However I've used lots of linear crossfades in the ballpark of 10 ms, which seemed to work fine. I couldn't hear anything wrong and never had any user complaints about such crossfades. So maybe some kinds of linear (slew rate limited) envelope following would also work ok even if in theory it might be more perverted than marrying a chicken.
Linear envelope slopes in dB space, might sound natural, or maybe it would not sound natural. The ear seems to get along well with dBs.
There would be ways of speed optimization, but the slow method-- Convert the samples to something like dB. You wouldn't have to multiply the log10 by 20. And a natural log or log2 would do just as good, just different scaling.
Do linear smoothing on the log space samples. One could convert the finished envelope back to non-log scaling if the algorithm requires it. For feedforward designs, maybe it would be most convenient to leave the envelope in log space for doing the gain calculations.
If you convert samples to log, linear smooth, then convert the envelope back to non-log for graphing-- The smoothed envelope would still be curvy. It would just be a different flavor of curvy than the RC curvy. Might work better, might not. Dunno.
Been a few years since I made a dynamics processor, just been thinking about it lately. I don't recall using any other shape of smoother on old analog homebrew compressors or later software dynamics processors.
In several old analog circuits and in digital dynamics, I used multiple series or parallel RC smoothers. As aciddose says, perhaps a carefully chosen Q on a higher order filter would be better still. With series first order sections at least you don't have to worry about overshoot. For instance, two series first order smoothers is "similar" to a second order bessel. Just slightly droopier.
In the past I'd see messages about other smoother shapes, and be skeptical. However have never tried other shapes so dunno whether some other shape might have advantages. Maybe I should try a few different shapes just to find out what happens.
For instance, to hear some folks tell it, linear crossfades are more perverted than marrying a chicken. However I've used lots of linear crossfades in the ballpark of 10 ms, which seemed to work fine. I couldn't hear anything wrong and never had any user complaints about such crossfades. So maybe some kinds of linear (slew rate limited) envelope following would also work ok even if in theory it might be more perverted than marrying a chicken.
Linear envelope slopes in dB space, might sound natural, or maybe it would not sound natural. The ear seems to get along well with dBs.
There would be ways of speed optimization, but the slow method-- Convert the samples to something like dB. You wouldn't have to multiply the log10 by 20. And a natural log or log2 would do just as good, just different scaling.
Do linear smoothing on the log space samples. One could convert the finished envelope back to non-log scaling if the algorithm requires it. For feedforward designs, maybe it would be most convenient to leave the envelope in log space for doing the gain calculations.
If you convert samples to log, linear smooth, then convert the envelope back to non-log for graphing-- The smoothed envelope would still be curvy. It would just be a different flavor of curvy than the RC curvy. Might work better, might not. Dunno.
Last edited by JCJR on Sun Aug 23, 2015 6:12 pm, edited 1 time in total.
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
Sorry, that doesn't work this way. To get a linear dB, you have to use an exponential somewhere.camsr wrote:A linear envelope could be put through a square function to make it linear dB, and it works over the entire range with a 2^x correction.
-
- KVRAF
- 7402 posts since 17 Feb, 2005
2^x right? Sorry I think I had a braindrain when I wrote that. 2^x is a linear dB transfer.Miles1981 wrote:Sorry, that doesn't work this way. To get a linear dB, you have to use an exponential somewhere.camsr wrote:A linear envelope could be put through a square function to make it linear dB, and it works over the entire range with a 2^x correction.
-
- KVRAF
- 3080 posts since 17 Apr, 2005 from S.E. TN
As far as drawing straight lines for envelope follower (if one would want to do that) have seen various methods described in old dsp messages. Would need to think about it some. Conceptual mistakes seem easier to make every year, and conceptual mistakes were never difficult to make.
One easy way that seems to make sense at the moment, would be an ordinary boxcar FIR. At least that would draw straight lines on stepped test signals, so maybe it would also fit the definition on moving-target actual audio signals.
For example, at 44.1 KHz samplerate, a moving average filter of length 441 ought to draw 10 ms straight lines for attack and release when applied to long duration stepped test signals, wheras the 10 ms TC RC process would draw the curved lines, convex on attack and concave on release.
Several cascaded moving average filters ought to approximately gaussian smooth the steps.
BTW, in case this seems too wrongheaded to use in a compressor-- Well maybe it IS too wrongheaded. Just thinking out loud. However, am thinking that the attack-release smoother would not be the only smoothing going on. I imagine earlier processes to kill off most audio-frequency ripple, BEFORE applying an attack-release process.
One easy way that seems to make sense at the moment, would be an ordinary boxcar FIR. At least that would draw straight lines on stepped test signals, so maybe it would also fit the definition on moving-target actual audio signals.
For example, at 44.1 KHz samplerate, a moving average filter of length 441 ought to draw 10 ms straight lines for attack and release when applied to long duration stepped test signals, wheras the 10 ms TC RC process would draw the curved lines, convex on attack and concave on release.
Several cascaded moving average filters ought to approximately gaussian smooth the steps.
BTW, in case this seems too wrongheaded to use in a compressor-- Well maybe it IS too wrongheaded. Just thinking out loud. However, am thinking that the attack-release smoother would not be the only smoothing going on. I imagine earlier processes to kill off most audio-frequency ripple, BEFORE applying an attack-release process.
-
- KVRian
- Topic Starter
- 1097 posts since 28 May, 2010 from Finland
So how do you get from the stuff in p. 22 (or 52 in the book):
http://www.music.mcgill.ca/~ich/classes ... sChap2.pdf
to
http://www.music.mcgill.ca/~ich/classes ... sChap2.pdf
to
And how does the K-parameter operate? I.e. why is K=0.5 -> 6dB cut, but K=2 6dB boost.Max M. wrote: Band-shelving filter output can be defined as:
y = (x + A(x) + K * (x - A(x)) / 2;
where A(x) is the allpass output and K is your boost/cut gain from 0 to Inf (e.g. K=0.5 -> 6dB cut, K=2
-> 6dB boost etc.).
P.S. Obviously the same formula can be reordered in whatever way to fit a particular implementation, e.g.:
y = x * (1 + K) / 2 + A(x) * (1 - K) / 2;
etc. etc.
-
- KVRian
- Topic Starter
- 1097 posts since 28 May, 2010 from Finland
Is the
y = x * (1 + K) / 2 + A(x) * (1 - K) / 2;
Same as here (it's the peakfilt.m in DAFX):
y[n] = 0.5 * H0 * (x[n] - ap_y) + x[n]
where H0 = 10^(G/20) - 1
and G is the gain.
y = x * (1 + K) / 2 + A(x) * (1 - K) / 2;
Same as here (it's the peakfilt.m in DAFX):
y[n] = 0.5 * H0 * (x[n] - ap_y) + x[n]
where H0 = 10^(G/20) - 1
and G is the gain.
Last edited by soundmodel on Thu Aug 27, 2015 5:47 pm, edited 1 time in total.
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
K is between -1 and 1 (usually, barycenter view of the equation).Fluky wrote:So how do you get from the stuff in p. 22 (or 52 in the book):
http://www.music.mcgill.ca/~ich/classes ... sChap2.pdf
to
And how does the K-parameter operate? I.e. why is K=0.5 -> 6dB cut, but K=2 6dB boost.Max M. wrote: Band-shelving filter output can be defined as:
y = (x + A(x) + K * (x - A(x)) / 2;
where A(x) is the allpass output and K is your boost/cut gain from 0 to Inf (e.g. K=0.5 -> 6dB cut, K=2
-> 6dB boost etc.).
P.S. Obviously the same formula can be reordered in whatever way to fit a particular implementation, e.g.:
y = x * (1 + K) / 2 + A(x) * (1 - K) / 2;
etc. etc.
Last edited by Miles1981 on Thu Aug 27, 2015 5:43 pm, edited 1 time in total.
-
- KVRAF
- 3080 posts since 17 Apr, 2005 from S.E. TN
Probably this way:Fluky wrote: And how does the K-parameter operate? I.e. why is K=0.5 -> 6dB cut, but K=2 6dB boost.
dB = 20 * log10( OutputLevel / InputLevel )
So if gain is 2, the OutputLevel is double the input level, which calcs with the above formula very close to +6 dB.
If Gain is 0.5, Output Level is half the InputLevel, and that calcs very close to -6 dB.
If you have dB but want the gain number instead, flip the dB formula inside out something like this--
Gain = 10 ^ ( dB / 20 )
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
I can't see the page, but it could be rewritten, of course...Fluky wrote:Is the
y = x * (1 + K) / 2 + A(x) * (1 - K) / 2;
Same as here:
y[n] = 0.5 * H0 * (x[n] - ap_y) + x[n]
where H0 = 10^(G/20) - 1
and G is the gain.
-
- KVRian
- Topic Starter
- 1097 posts since 28 May, 2010 from Finland
So using that equation how deep cuts or how high peaks one gets?
Or do I need to cascade four of them to get ±24dB boost/cut.
Or do I need to cascade four of them to get ±24dB boost/cut.
-
- KVRAF
- 3080 posts since 17 Apr, 2005 from S.E. TN
I have no reason to doubt the validity of the basic idea of the boost and cut using max's described method.
Assuming both methods actually work, that second formula--
H0 = 10^(G/20) - 1
That G would be dB, and that H0 is dB converted to a linear gain multiplier, minus 1.
Assuming both methods actually work, that second formula--
H0 = 10^(G/20) - 1
That G would be dB, and that H0 is dB converted to a linear gain multiplier, minus 1.
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
For the first formula, if A(x) is the all pass, a complete cut is achieved with K = 0. With K=1, you have the original signal.
I messed up the barycenter explanation, it's true on the second equation, not the first one :/
I messed up the barycenter explanation, it's true on the second equation, not the first one :/
-
- KVRAF
- 3080 posts since 17 Apr, 2005 from S.E. TN
Using Max's K, I believe for 24 dB boost or cut--
k = 10^(dB/20)
So for +24 dB, k = 15.85
For -24 dB, k = 0.0631
Using that H0 formula, it is just the above k, minus 1
+24 , H0 = 14.85
-24 , H0 = -0.937
k = 10^(dB/20)
So for +24 dB, k = 15.85
For -24 dB, k = 0.0631
Using that H0 formula, it is just the above k, minus 1
+24 , H0 = 14.85
-24 , H0 = -0.937