Re: [music-dsp] Lerping Biquad coefficients to a flat response
Ah, I wondered what you meant about those parenthesis! The better efficiency comes from avoiding all the divisions (I don't normalise out a0 in my implementation) - it's a pretty trivial performance difference in reality but the coefficient equations are a little bit neater as well - less of those confusing parenthesis ;) -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of robert bristow-johnson Sent: 04 January 2013 20:59 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 1/4/13 1:29 PM, Thomas Young wrote: Er.. yes sorry I transcribed it wrong, well spotted a1: ( - 2 * cos(w0) ) * A^2 ooops! i'm embarrassed! i was thinking it was -2 + cos(), sorry! can't believe it. chalk it up to being a year older and losing one year's portion of brain cells. So yea it's the same, I just rearranged it a bit for efficiency dunno what's more efficient before normalizing out a0, but if it's after, you change only the numerator feedforward coefs and you would multiply them by the reciprocal of what the linear peak gain, 1/A^2. sorry, that parenth thing must be early onset alzheimer's. bestest, r b-j -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of robert bristow-johnson Sent: 04 January 2013 18:25 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 1/4/13 1:11 PM, Thomas Young wrote: someone tell me what it was about In a nutshell... Q: What is the equation for the coefficients of a peaking EQ biquad filter with constant 0 dB peak gain? A: This (using cookbook variables): b0: 1 + alpha * A b1: -2 * cos(w0) b2: 1 - alpha * A a0: A^2 + alpha * A a1: - 2 * cos(w0) * A^2--- are sure you don't need pareths here? a2: A^2 - alpha * A dragged over a lot of emails ;) yeah, i guess that's the same as b0: (1 + alpha * A)/A^2 b1: (-2 * cos(w0)/A^2 b2: (1 - alpha * A)/A^2 a0: 1 + alpha / A a1: -2 * cos(w0) a2: 1 - alpha / A if you put in the parenths where you should, i think these are the same. r b0j -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of robert bristow-johnson Sent: 04 January 2013 17:58 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response looks like i came here late. someone tell me what it was about. admittedly, i didn't completely understand from a cursory reading. the only difference between the two BPFs in the cookbook is that of a constant gain factor. in one the peak of the BPF is always at zero dB. in the other, if you were to project the asymptotes of the skirt of the freq response (you know, the +6 dB/oct line and the -6 dB/oct line), they will intersect at the point that is 0 dB and at the resonant frequency. otherwise same shape, same filter. the peaking EQ is a BPF with gain A^2 - 1 with the output added to a wire. and, only on the peaking EQ, the definition of Q is fudged so that it continues to be related to BW in the same manner and so the cut response exactly undoes a boost response for the same dB, same f0, same Q. nothing more to it than that. no Orfanidis subtlety. if the resonant frequency is much less than Nyquist, then there is even symmetry of magnitude about f0 (on a log(f) scale) for BPF, notch, APF, and peaking EQ. for the two shelves, it's odd symmetry about f0 (if you adjust for half of the dB shelf gain). the only difference between the high shelf and low shelf is a gain constant and flipping the rest of the transfer function upside down. this is the case no matter what the dB boost is or the Q (or S). if f0 approaches Fs/2, then that even or odd symmetry gets warped from the BLT and ain't so symmetrical anymore. nothing else comes to mind. -- r b-j r...@audioimagination.com Imagination is more important than knowledge. -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp
Re: [music-dsp] Lerping Biquad coefficients to a flat response
On 4/01/2013 4:34 AM, Thomas Young wrote: However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. I read quickly this morning and missed this…with something like a lowpass, you do get irregularities, but with something like a peaking filter it stays pretty smooth when summing with the original signal (I guess because the phase change is smoother, with the second order split up between two halves). So that part isn't a problem, BUT… Consider a wet/dry mix…say you have a 6 dB peak that you want to move down to 0 dB (skirts down to -6 dB). OK, at 0% wet you have a flat line at 0 dB. At 100% wet you have your 6 dB peak again (skirt at 0 dB). At 50% wet, you have about a 3 dB peak, skirt still at 0 dB. There is no setting that will give you anything but the skit at 0 dB. Again, as Ross said earlier, you could have just an output gain—set it to 0.5 (-6 dB), and now you have your skirt at - 6 dB, peak at 0 dB. But a wet/dry mix know is not going to do it. Ross said: There is only a difference of scale factors between your constraints and the RBJ peaking filter constraints so you should be able to use them with minor modifications (as Nigel suggests, although I didn't take the time to review his result). Assuming that you want the gain at DC and nyquist to be equal to your stopband gain then this is pretty much equivalent to the RBJ coefficient formulas except that Robert computed them under the requirement of unity gain at DC and Nyquist, and some specified gain at cf. You want unity gain at cf and specified gain at DC and Nyquist. This seems to me to just be a direct reinterpretation of the gain values. You should be able to propagate the needed gain values through Robert's formulas. Actually, it's more than a reinterpretation of the gain values (note that no matter what gain you give it, you won't get anything like what Thomas is after). The poles are peaking the filter and the zeros are holding down the shirt (at 0 dB in the unmodified filter); obviously the transfer function is arranged to keep that relationship at any gain setting. So, you need to change it so that the gain is controlling something else—changing the relationship of the motion between the poles and zeros (the mod I gave does that). On Jan 3, 2013, at 10:34 PM, Ross Bencina rossb-li...@audiomulch.com wrote: Hi Thomas, Replying to both of your messages at once... On 4/01/2013 4:34 AM, Thomas Young wrote: However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. Someone else might correct me on this, but I'm not sure that will get you the same effect. Your proposal seems to be based on the assumption that the filter is phase linear and 0 delay (ie that the phases all line up between input and filtered version). That's not the case. In reality you'd be mixing the phase-warped and delayed (filtered) signal with the original-phase signal. I couldn't tell you what the frequency response would look like, but probably not as good as just scaling the peaking filter output. On 4/01/2013 6:03 AM, Thomas Young wrote: Additional optional mumblings: I think really there are two 'correct' solutions to manipulating only the coefficients to my ends (that is, generation of coefficients which produce filters interpolating from bandpass to flat): The first is to go from pole/zero to transfer function, basically as you (Nigel) described in your first message - stick the zeros in the centre, poles near the edge of the unit circle and reduce their radii - doing the maths to convert these into the appropriate biquad coefficients. This isn't really feasible for me to do in realtime though. I was trying to do a sort of tricksy workaround by lerping from one set of coefficients to another but on reflection I don't think there is any mathematical correctness there. The second is to have an analogue prototype which somehow includes skirt gain and take the bilinear transform to get the equations for the coefficients. I'm not really very good with the s domain either so I actually wouldn't know how to go about this, but it's what I was originally thinking of. In the end you're going to have a set of constraints on the frequency response and you need to solve for the coefficients. You can do that in the s domain and BLT or do it directly in the z domain. See the stuck with filter design thread from November 17, 2012 for a nice discussion and links to background reading. There is only a difference of scale factors between your constraints and the RBJ peaking filter constraints so you should be able to use them with minor modifications (as Nigel
Re: [music-dsp] Lerping Biquad coefficients to a flat response
Hi Nigel, which analogue prototype are you referring to when you suggest multiplying denominator coefficients by the gain factor, the peaking one? -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Nigel Redmon Sent: 04 January 2013 09:26 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 4/01/2013 4:34 AM, Thomas Young wrote: However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. I read quickly this morning and missed this...with something like a lowpass, you do get irregularities, but with something like a peaking filter it stays pretty smooth when summing with the original signal (I guess because the phase change is smoother, with the second order split up between two halves). So that part isn't a problem, BUT... Consider a wet/dry mix...say you have a 6 dB peak that you want to move down to 0 dB (skirts down to -6 dB). OK, at 0% wet you have a flat line at 0 dB. At 100% wet you have your 6 dB peak again (skirt at 0 dB). At 50% wet, you have about a 3 dB peak, skirt still at 0 dB. There is no setting that will give you anything but the skit at 0 dB. Again, as Ross said earlier, you could have just an output gain-set it to 0.5 (-6 dB), and now you have your skirt at - 6 dB, peak at 0 dB. But a wet/dry mix know is not going to do it. Ross said: There is only a difference of scale factors between your constraints and the RBJ peaking filter constraints so you should be able to use them with minor modifications (as Nigel suggests, although I didn't take the time to review his result). Assuming that you want the gain at DC and nyquist to be equal to your stopband gain then this is pretty much equivalent to the RBJ coefficient formulas except that Robert computed them under the requirement of unity gain at DC and Nyquist, and some specified gain at cf. You want unity gain at cf and specified gain at DC and Nyquist. This seems to me to just be a direct reinterpretation of the gain values. You should be able to propagate the needed gain values through Robert's formulas. Actually, it's more than a reinterpretation of the gain values (note that no matter what gain you give it, you won't get anything like what Thomas is after). The poles are peaking the filter and the zeros are holding down the shirt (at 0 dB in the unmodified filter); obviously the transfer function is arranged to keep that relationship at any gain setting. So, you need to change it so that the gain is controlling something else-changing the relationship of the motion between the poles and zeros (the mod I gave does that). On Jan 3, 2013, at 10:34 PM, Ross Bencina rossb-li...@audiomulch.com wrote: Hi Thomas, Replying to both of your messages at once... On 4/01/2013 4:34 AM, Thomas Young wrote: However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. Someone else might correct me on this, but I'm not sure that will get you the same effect. Your proposal seems to be based on the assumption that the filter is phase linear and 0 delay (ie that the phases all line up between input and filtered version). That's not the case. In reality you'd be mixing the phase-warped and delayed (filtered) signal with the original-phase signal. I couldn't tell you what the frequency response would look like, but probably not as good as just scaling the peaking filter output. On 4/01/2013 6:03 AM, Thomas Young wrote: Additional optional mumblings: I think really there are two 'correct' solutions to manipulating only the coefficients to my ends (that is, generation of coefficients which produce filters interpolating from bandpass to flat): The first is to go from pole/zero to transfer function, basically as you (Nigel) described in your first message - stick the zeros in the centre, poles near the edge of the unit circle and reduce their radii - doing the maths to convert these into the appropriate biquad coefficients. This isn't really feasible for me to do in realtime though. I was trying to do a sort of tricksy workaround by lerping from one set of coefficients to another but on reflection I don't think there is any mathematical correctness there. The second is to have an analogue prototype which somehow includes skirt gain and take the bilinear transform to get the equations for the coefficients. I'm not really very good with the s domain either so I actually wouldn't know how to go about this, but it's what I was originally thinking of. In the end you're going to have a set
Re: [music-dsp] Lerping Biquad coefficients to a flat response
Aha, success! Multiplying denominator coefficients of the peaking filter by A^2 does indeed have the desired effect. Thank you very much for the help -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Thomas Young Sent: 04 January 2013 10:33 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response Hi Nigel, which analogue prototype are you referring to when you suggest multiplying denominator coefficients by the gain factor, the peaking one? -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Nigel Redmon Sent: 04 January 2013 09:26 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 4/01/2013 4:34 AM, Thomas Young wrote: However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. I read quickly this morning and missed this...with something like a lowpass, you do get irregularities, but with something like a peaking filter it stays pretty smooth when summing with the original signal (I guess because the phase change is smoother, with the second order split up between two halves). So that part isn't a problem, BUT... Consider a wet/dry mix...say you have a 6 dB peak that you want to move down to 0 dB (skirts down to -6 dB). OK, at 0% wet you have a flat line at 0 dB. At 100% wet you have your 6 dB peak again (skirt at 0 dB). At 50% wet, you have about a 3 dB peak, skirt still at 0 dB. There is no setting that will give you anything but the skit at 0 dB. Again, as Ross said earlier, you could have just an output gain-set it to 0.5 (-6 dB), and now you have your skirt at - 6 dB, peak at 0 dB. But a wet/dry mix know is not going to do it. Ross said: There is only a difference of scale factors between your constraints and the RBJ peaking filter constraints so you should be able to use them with minor modifications (as Nigel suggests, although I didn't take the time to review his result). Assuming that you want the gain at DC and nyquist to be equal to your stopband gain then this is pretty much equivalent to the RBJ coefficient formulas except that Robert computed them under the requirement of unity gain at DC and Nyquist, and some specified gain at cf. You want unity gain at cf and specified gain at DC and Nyquist. This seems to me to just be a direct reinterpretation of the gain values. You should be able to propagate the needed gain values through Robert's formulas. Actually, it's more than a reinterpretation of the gain values (note that no matter what gain you give it, you won't get anything like what Thomas is after). The poles are peaking the filter and the zeros are holding down the shirt (at 0 dB in the unmodified filter); obviously the transfer function is arranged to keep that relationship at any gain setting. So, you need to change it so that the gain is controlling something else-changing the relationship of the motion between the poles and zeros (the mod I gave does that). On Jan 3, 2013, at 10:34 PM, Ross Bencina rossb-li...@audiomulch.com wrote: Hi Thomas, Replying to both of your messages at once... On 4/01/2013 4:34 AM, Thomas Young wrote: However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. Someone else might correct me on this, but I'm not sure that will get you the same effect. Your proposal seems to be based on the assumption that the filter is phase linear and 0 delay (ie that the phases all line up between input and filtered version). That's not the case. In reality you'd be mixing the phase-warped and delayed (filtered) signal with the original-phase signal. I couldn't tell you what the frequency response would look like, but probably not as good as just scaling the peaking filter output. On 4/01/2013 6:03 AM, Thomas Young wrote: Additional optional mumblings: I think really there are two 'correct' solutions to manipulating only the coefficients to my ends (that is, generation of coefficients which produce filters interpolating from bandpass to flat): The first is to go from pole/zero to transfer function, basically as you (Nigel) described in your first message - stick the zeros in the centre, poles near the edge of the unit circle and reduce their radii - doing the maths to convert these into the appropriate biquad coefficients. This isn't really feasible for me to do in realtime though. I was trying to do a sort of tricksy workaround by lerping from one set of coefficients
Re: [music-dsp] Lerping Biquad coefficients to a flat response
This is cracking me up, keep going! We want more!!! Soon you'll have a one hour DSP comedy special! On 1/3/13 5:22 PM, Nigel Redmon wrote: sigh…hopefully my last post on this… Sorry, I looked at rbi's peak spec and it is symmetrical—I was thinking of his shelving filters, which need to be inverted for symmetry. So just multiply the denominator coefficients by A^2 and you're done. On Jan 3, 2013, at 2:02 PM, Nigel Redmon earle...@earlevel.com wrote: Glad I read this again—brain thought one thing, and fingers typed another—multiply the denominator by A^2, not numerator. Oh, and for cut…it depends on if you want symmetrical response or not, but if you do, just swap a and b coefficients (yes, after multiplying by the A^2 factor so it ends up on top) On Jan 3, 2013, at 1:20 PM, Nigel Redmon earle...@earlevel.com wrote: Well, you're already working with rbj's equations, so just multiple the numerator coefficients by A^2... On Jan 3, 2013, at 1:05 PM, Nigel Redmon earle...@earlevel.com wrote: OK, I had (well, took) time to think: You need to divide the numerator by the gain (A), and multiple the denominator by the gain (aka multiply the numerator by A^2). That will keep the peak at unity. Swap the numerator and denominator if you want the EQ to be symmetric for cut and boost. If you need the BLT worked out, let me know. On Jan 3, 2013, at 11:03 AM, Thomas Young thomas.yo...@rebellion.co.uk wrote: Thanks Nigel - I have just been playing around with the pole/zero plotter (very helpful app for visualising the problem) and thinking about it. You guys are probably right the simplest approach is just to scale the output and using the peaking filter. Additional optional mumblings: I think really there are two 'correct' solutions to manipulating only the coefficients to my ends (that is, generation of coefficients which produce filters interpolating from bandpass to flat): The first is to go from pole/zero to transfer function, basically as you (Nigel) described in your first message - stick the zeros in the centre, poles near the edge of the unit circle and reduce their radii - doing the maths to convert these into the appropriate biquad coefficients. This isn't really feasible for me to do in realtime though. I was trying to do a sort of tricksy workaround by lerping from one set of coefficients to another but on reflection I don't think there is any mathematical correctness there. The second is to have an analogue prototype which somehow includes skirt gain and take the bilinear transform to get the equations for the coefficients. I'm not really very good with the s domain either so I actually wouldn't know how to go about this, but it's what I was originally thinking of. Thanks for the help -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Nigel Redmon Sent: 03 January 2013 18:48 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response Thomas-it's a matter of manipulating the A and Q relationships in the numerator and denominator of the peaking EQ analog prototypes. I'm not as good in thinking in the s domain as the z, so I'd have to plot it out and think-too busy right now, though it's pretty trivial. But just doing the gain adjustment to the existing peaking EQ, as Ross suggested, is trivial. Not much reason to go through the fuss unless you're concerned about adding a single multiply. (To add to the confusion, my peaking implementation is different for gain and boost, so that the EQ remains symmetrical, a la Zolzer). On Jan 3, 2013, at 9:34 AM, Thomas Young thomas.yo...@rebellion.co.uk wrote: I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist Yes I think this is essentially my problem, there are no stop bands per-se just zeros which I was basically trying to lerp away - which I guess isn't really the correct approach. The solution you are proposing would work I believe; along the same lines there is a different bandpass filter in the RBJCB which has a constant stop band gain (or 'skirt gain' as he calls it) and peak gain for the passband - so a similar technique would work there by scaling the output. However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. I feel in my gut there must be some way to do it by just manipulating coefficients. -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Ross Bencina Sent: 03 January 2013 17:16 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 4/01/2013 4:05 AM, Thomas Young wrote: Is there a way to modify the bandpass coefficient equations in the cookbook (the one from the analogue
Re: [music-dsp] Lerping Biquad coefficients to a flat response
looks like i came here late. someone tell me what it was about. admittedly, i didn't completely understand from a cursory reading. the only difference between the two BPFs in the cookbook is that of a constant gain factor. in one the peak of the BPF is always at zero dB. in the other, if you were to project the asymptotes of the skirt of the freq response (you know, the +6 dB/oct line and the -6 dB/oct line), they will intersect at the point that is 0 dB and at the resonant frequency. otherwise same shape, same filter. the peaking EQ is a BPF with gain A^2 - 1 with the output added to a wire. and, only on the peaking EQ, the definition of Q is fudged so that it continues to be related to BW in the same manner and so the cut response exactly undoes a boost response for the same dB, same f0, same Q. nothing more to it than that. no Orfanidis subtlety. if the resonant frequency is much less than Nyquist, then there is even symmetry of magnitude about f0 (on a log(f) scale) for BPF, notch, APF, and peaking EQ. for the two shelves, it's odd symmetry about f0 (if you adjust for half of the dB shelf gain). the only difference between the high shelf and low shelf is a gain constant and flipping the rest of the transfer function upside down. this is the case no matter what the dB boost is or the Q (or S). if f0 approaches Fs/2, then that even or odd symmetry gets warped from the BLT and ain't so symmetrical anymore. nothing else comes to mind. -- r b-j r...@audioimagination.com Imagination is more important than knowledge. On 1/4/13 11:23 AM, Nigel Redmon wrote: Great! On Jan 4, 2013, at 2:40 AM, Thomas Youngthomas.yo...@rebellion.co.uk wrote: Aha, success! Multiplying denominator coefficients of the peaking filter by A^2 does indeed have the desired effect. Thank you very much for the help -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Thomas Young Sent: 04 January 2013 10:33 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response Hi Nigel, which analogue prototype are you referring to when you suggest multiplying denominator coefficients by the gain factor, the peaking one? -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Nigel Redmon Sent: 04 January 2013 09:26 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 4/01/2013 4:34 AM, Thomas Young wrote: However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. I read quickly this morning and missed this...with something like a lowpass, you do get irregularities, but with something like a peaking filter it stays pretty smooth when summing with the original signal (I guess because the phase change is smoother, with the second order split up between two halves). So that part isn't a problem, BUT... Consider a wet/dry mix...say you have a 6 dB peak that you want to move down to 0 dB (skirts down to -6 dB). OK, at 0% wet you have a flat line at 0 dB. At 100% wet you have your 6 dB peak again (skirt at 0 dB). At 50% wet, you have about a 3 dB peak, skirt still at 0 dB. There is no setting that will give you anything but the skit at 0 dB. Again, as Ross said earlier, you could have just an output gain-set it to 0.5 (-6 dB), and now you have your skirt at - 6 dB, peak at 0 dB. But a wet/dry mix know is not going to do it. Ross said: There is only a difference of scale factors between your constraints and the RBJ peaking filter constraints so you should be able to use them with minor modifications (as Nigel suggests, although I didn't take the time to review his result). Assuming that you want the gain at DC and nyquist to be equal to your stopband gain then this is pretty much equivalent to the RBJ coefficient formulas except that Robert computed them under the requirement of unity gain at DC and Nyquist, and some specified gain at cf. You want unity gain at cf and specified gain at DC and Nyquist. This seems to me to just be a direct reinterpretation of the gain values. You should be able to propagate the needed gain values through Robert's formulas. Actually, it's more than a reinterpretation of the gain values (note that no matter what gain you give it, you won't get anything like what Thomas is after). The poles are peaking the filter and the zeros are holding down the shirt (at 0 dB in the unmodified filter); obviously the transfer function is arranged to keep that relationship at any gain setting. So, you need to change it so that the gain is controlling something else-changing the relationship of the motion between the poles
Re: [music-dsp] Lerping Biquad coefficients to a flat response
someone tell me what it was about In a nutshell... Q: What is the equation for the coefficients of a peaking EQ biquad filter with constant 0 dB peak gain? A: This (using cookbook variables): b0: 1 + alpha * A b1: -2 * cos(w0) b2: 1 - alpha * A a0: A^2 + alpha * A a1: - 2 * cos(w0) * A^2 a2: A^2 - alpha * A dragged over a lot of emails ;) -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of robert bristow-johnson Sent: 04 January 2013 17:58 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response looks like i came here late. someone tell me what it was about. admittedly, i didn't completely understand from a cursory reading. the only difference between the two BPFs in the cookbook is that of a constant gain factor. in one the peak of the BPF is always at zero dB. in the other, if you were to project the asymptotes of the skirt of the freq response (you know, the +6 dB/oct line and the -6 dB/oct line), they will intersect at the point that is 0 dB and at the resonant frequency. otherwise same shape, same filter. the peaking EQ is a BPF with gain A^2 - 1 with the output added to a wire. and, only on the peaking EQ, the definition of Q is fudged so that it continues to be related to BW in the same manner and so the cut response exactly undoes a boost response for the same dB, same f0, same Q. nothing more to it than that. no Orfanidis subtlety. if the resonant frequency is much less than Nyquist, then there is even symmetry of magnitude about f0 (on a log(f) scale) for BPF, notch, APF, and peaking EQ. for the two shelves, it's odd symmetry about f0 (if you adjust for half of the dB shelf gain). the only difference between the high shelf and low shelf is a gain constant and flipping the rest of the transfer function upside down. this is the case no matter what the dB boost is or the Q (or S). if f0 approaches Fs/2, then that even or odd symmetry gets warped from the BLT and ain't so symmetrical anymore. nothing else comes to mind. -- r b-j r...@audioimagination.com Imagination is more important than knowledge. On 1/4/13 11:23 AM, Nigel Redmon wrote: Great! On Jan 4, 2013, at 2:40 AM, Thomas Youngthomas.yo...@rebellion.co.uk wrote: Aha, success! Multiplying denominator coefficients of the peaking filter by A^2 does indeed have the desired effect. Thank you very much for the help -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Thomas Young Sent: 04 January 2013 10:33 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response Hi Nigel, which analogue prototype are you referring to when you suggest multiplying denominator coefficients by the gain factor, the peaking one? -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Nigel Redmon Sent: 04 January 2013 09:26 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 4/01/2013 4:34 AM, Thomas Young wrote: However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. I read quickly this morning and missed this...with something like a lowpass, you do get irregularities, but with something like a peaking filter it stays pretty smooth when summing with the original signal (I guess because the phase change is smoother, with the second order split up between two halves). So that part isn't a problem, BUT... Consider a wet/dry mix...say you have a 6 dB peak that you want to move down to 0 dB (skirts down to -6 dB). OK, at 0% wet you have a flat line at 0 dB. At 100% wet you have your 6 dB peak again (skirt at 0 dB). At 50% wet, you have about a 3 dB peak, skirt still at 0 dB. There is no setting that will give you anything but the skit at 0 dB. Again, as Ross said earlier, you could have just an output gain-set it to 0.5 (-6 dB), and now you have your skirt at - 6 dB, peak at 0 dB. But a wet/dry mix know is not going to do it. Ross said: There is only a difference of scale factors between your constraints and the RBJ peaking filter constraints so you should be able to use them with minor modifications (as Nigel suggests, although I didn't take the time to review his result). Assuming that you want the gain at DC and nyquist to be equal to your stopband gain then this is pretty much equivalent to the RBJ coefficient formulas except that Robert computed them under the requirement of unity gain at DC and Nyquist, and some specified gain at cf. You want unity gain
Re: [music-dsp] Lerping Biquad coefficients to a flat response
On 1/4/13 1:11 PM, Thomas Young wrote: someone tell me what it was about In a nutshell... Q: What is the equation for the coefficients of a peaking EQ biquad filter with constant 0 dB peak gain? A: This (using cookbook variables): b0: 1 + alpha * A b1: -2 * cos(w0) b2: 1 - alpha * A a0: A^2 + alpha * A a1: - 2 * cos(w0) * A^2--- are sure you don't need pareths here? a2: A^2 - alpha * A dragged over a lot of emails ;) yeah, i guess that's the same as b0: (1 + alpha * A)/A^2 b1: (-2 * cos(w0)/A^2 b2: (1 - alpha * A)/A^2 a0: 1 + alpha / A a1: -2 * cos(w0) a2: 1 - alpha / A if you put in the parenths where you should, i think these are the same. r b0j -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of robert bristow-johnson Sent: 04 January 2013 17:58 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response looks like i came here late. someone tell me what it was about. admittedly, i didn't completely understand from a cursory reading. the only difference between the two BPFs in the cookbook is that of a constant gain factor. in one the peak of the BPF is always at zero dB. in the other, if you were to project the asymptotes of the skirt of the freq response (you know, the +6 dB/oct line and the -6 dB/oct line), they will intersect at the point that is 0 dB and at the resonant frequency. otherwise same shape, same filter. the peaking EQ is a BPF with gain A^2 - 1 with the output added to a wire. and, only on the peaking EQ, the definition of Q is fudged so that it continues to be related to BW in the same manner and so the cut response exactly undoes a boost response for the same dB, same f0, same Q. nothing more to it than that. no Orfanidis subtlety. if the resonant frequency is much less than Nyquist, then there is even symmetry of magnitude about f0 (on a log(f) scale) for BPF, notch, APF, and peaking EQ. for the two shelves, it's odd symmetry about f0 (if you adjust for half of the dB shelf gain). the only difference between the high shelf and low shelf is a gain constant and flipping the rest of the transfer function upside down. this is the case no matter what the dB boost is or the Q (or S). if f0 approaches Fs/2, then that even or odd symmetry gets warped from the BLT and ain't so symmetrical anymore. nothing else comes to mind. -- r b-j r...@audioimagination.com Imagination is more important than knowledge. -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp
Re: [music-dsp] Lerping Biquad coefficients to a flat response
Er.. yes sorry I transcribed it wrong, well spotted a1: ( - 2 * cos(w0) ) * A^2 So yea it's the same, I just rearranged it a bit for efficiency -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of robert bristow-johnson Sent: 04 January 2013 18:25 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 1/4/13 1:11 PM, Thomas Young wrote: someone tell me what it was about In a nutshell... Q: What is the equation for the coefficients of a peaking EQ biquad filter with constant 0 dB peak gain? A: This (using cookbook variables): b0: 1 + alpha * A b1: -2 * cos(w0) b2: 1 - alpha * A a0: A^2 + alpha * A a1: - 2 * cos(w0) * A^2--- are sure you don't need pareths here? a2: A^2 - alpha * A dragged over a lot of emails ;) yeah, i guess that's the same as b0: (1 + alpha * A)/A^2 b1: (-2 * cos(w0)/A^2 b2: (1 - alpha * A)/A^2 a0: 1 + alpha / A a1: -2 * cos(w0) a2: 1 - alpha / A if you put in the parenths where you should, i think these are the same. r b0j -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of robert bristow-johnson Sent: 04 January 2013 17:58 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response looks like i came here late. someone tell me what it was about. admittedly, i didn't completely understand from a cursory reading. the only difference between the two BPFs in the cookbook is that of a constant gain factor. in one the peak of the BPF is always at zero dB. in the other, if you were to project the asymptotes of the skirt of the freq response (you know, the +6 dB/oct line and the -6 dB/oct line), they will intersect at the point that is 0 dB and at the resonant frequency. otherwise same shape, same filter. the peaking EQ is a BPF with gain A^2 - 1 with the output added to a wire. and, only on the peaking EQ, the definition of Q is fudged so that it continues to be related to BW in the same manner and so the cut response exactly undoes a boost response for the same dB, same f0, same Q. nothing more to it than that. no Orfanidis subtlety. if the resonant frequency is much less than Nyquist, then there is even symmetry of magnitude about f0 (on a log(f) scale) for BPF, notch, APF, and peaking EQ. for the two shelves, it's odd symmetry about f0 (if you adjust for half of the dB shelf gain). the only difference between the high shelf and low shelf is a gain constant and flipping the rest of the transfer function upside down. this is the case no matter what the dB boost is or the Q (or S). if f0 approaches Fs/2, then that even or odd symmetry gets warped from the BLT and ain't so symmetrical anymore. nothing else comes to mind. -- r b-j r...@audioimagination.com Imagination is more important than knowledge. -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp
Re: [music-dsp] Lerping Biquad coefficients to a flat response
On 1/4/13 1:29 PM, Thomas Young wrote: Er.. yes sorry I transcribed it wrong, well spotted a1: ( - 2 * cos(w0) ) * A^2 ooops! i'm embarrassed! i was thinking it was -2 + cos(), sorry! can't believe it. chalk it up to being a year older and losing one year's portion of brain cells. So yea it's the same, I just rearranged it a bit for efficiency dunno what's more efficient before normalizing out a0, but if it's after, you change only the numerator feedforward coefs and you would multiply them by the reciprocal of what the linear peak gain, 1/A^2. sorry, that parenth thing must be early onset alzheimer's. bestest, r b-j -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of robert bristow-johnson Sent: 04 January 2013 18:25 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 1/4/13 1:11 PM, Thomas Young wrote: someone tell me what it was about In a nutshell... Q: What is the equation for the coefficients of a peaking EQ biquad filter with constant 0 dB peak gain? A: This (using cookbook variables): b0: 1 + alpha * A b1: -2 * cos(w0) b2: 1 - alpha * A a0: A^2 + alpha * A a1: - 2 * cos(w0) * A^2--- are sure you don't need pareths here? a2: A^2 - alpha * A dragged over a lot of emails ;) yeah, i guess that's the same as b0: (1 + alpha * A)/A^2 b1: (-2 * cos(w0)/A^2 b2: (1 - alpha * A)/A^2 a0: 1 + alpha / A a1: -2 * cos(w0) a2: 1 - alpha / A if you put in the parenths where you should, i think these are the same. r b0j -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of robert bristow-johnson Sent: 04 January 2013 17:58 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response looks like i came here late. someone tell me what it was about. admittedly, i didn't completely understand from a cursory reading. the only difference between the two BPFs in the cookbook is that of a constant gain factor. in one the peak of the BPF is always at zero dB. in the other, if you were to project the asymptotes of the skirt of the freq response (you know, the +6 dB/oct line and the -6 dB/oct line), they will intersect at the point that is 0 dB and at the resonant frequency. otherwise same shape, same filter. the peaking EQ is a BPF with gain A^2 - 1 with the output added to a wire. and, only on the peaking EQ, the definition of Q is fudged so that it continues to be related to BW in the same manner and so the cut response exactly undoes a boost response for the same dB, same f0, same Q. nothing more to it than that. no Orfanidis subtlety. if the resonant frequency is much less than Nyquist, then there is even symmetry of magnitude about f0 (on a log(f) scale) for BPF, notch, APF, and peaking EQ. for the two shelves, it's odd symmetry about f0 (if you adjust for half of the dB shelf gain). the only difference between the high shelf and low shelf is a gain constant and flipping the rest of the transfer function upside down. this is the case no matter what the dB boost is or the Q (or S). if f0 approaches Fs/2, then that even or odd symmetry gets warped from the BLT and ain't so symmetrical anymore. nothing else comes to mind. -- r b-j r...@audioimagination.com Imagination is more important than knowledge. -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp
Re: [music-dsp] Lerping Biquad coefficients to a flat response
On 4/01/2013 4:05 AM, Thomas Young wrote: Is there a way to modify the bandpass coefficient equations in the cookbook (the one from the analogue prototype H(s) = s / (s^2 + s/Q + 1)) such that the gain of the stopband may be specified? I want to be able I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist so I'm not sure how you're going to define stopband gain in this case :) Maybe start with the peaking filter and scale the output according to your desired stopband gain and then set the peak gain to give 0dB at the peak. peakGain_dB = -stopbandGain_dB (assuming -ve stopbandGain_dB). Does that help? Ross. -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp
Re: [music-dsp] Lerping Biquad coefficients to a flat response
The zeros are at DC and Nyquist because the numerator is s…Basically, you need to adjust the zeros based on the pole positions (both angle and Q) and the desired stop band spec. I'm not 100% sure what Thomas is after, but I suspect it's just an inversion of band reject (swap the poles and zeros). Which is to say it's pretty much a peaking EQ except that you're mucking with the gain to keep the peak constant while adjusting the stop band. You can play with the idea in the z domain with this applet: http://www.earlevel.com/main/2003/02/27/pole-zero-placement/ For Poles, leave Pair checked (for complex conjugate poles), raise Radius towards max, and give it some angle towards the middle. For Zeros, so the same, basically—use the same angle, but a smaller radius. The easiest way to line up the angle is to set both poles and zeros to max radius (unit circle), then set the angle sliders to match, then back off on the radius for each (just keep the zeros at a smaller radius than the poles). Adjust the radius to change the stop band level. The only other alternative is to uncheck Pair for the zeros, and slide then independently to balance the stop band the way you want it. If neither gives you what you're after, then you can't do it with a biquad. But it sounds like you (Thomas) want a peaking filter that keeps the maximum level constant and adjusts the skirts. On Jan 3, 2013, at 9:16 AM, Ross Bencina rossb-li...@audiomulch.com wrote: On 4/01/2013 4:05 AM, Thomas Young wrote: Is there a way to modify the bandpass coefficient equations in the cookbook (the one from the analogue prototype H(s) = s / (s^2 + s/Q + 1)) such that the gain of the stopband may be specified? I want to be able I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist so I'm not sure how you're going to define stopband gain in this case :) Maybe start with the peaking filter and scale the output according to your desired stopband gain and then set the peak gain to give 0dB at the peak. peakGain_dB = -stopbandGain_dB (assuming -ve stopbandGain_dB). Does that help? Ross. -- -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp
Re: [music-dsp] Lerping Biquad coefficients to a flat response
Thomas—it's a matter of manipulating the A and Q relationships in the numerator and denominator of the peaking EQ analog prototypes. I'm not as good in thinking in the s domain as the z, so I'd have to plot it out and think—too busy right now, though it's pretty trivial. But just doing the gain adjustment to the existing peaking EQ, as Ross suggested, is trivial. Not much reason to go through the fuss unless you're concerned about adding a single multiply. (To add to the confusion, my peaking implementation is different for gain and boost, so that the EQ remains symmetrical, a la Zolzer). On Jan 3, 2013, at 9:34 AM, Thomas Young thomas.yo...@rebellion.co.uk wrote: I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist Yes I think this is essentially my problem, there are no stop bands per-se just zeros which I was basically trying to lerp away - which I guess isn't really the correct approach. The solution you are proposing would work I believe; along the same lines there is a different bandpass filter in the RBJCB which has a constant stop band gain (or 'skirt gain' as he calls it) and peak gain for the passband - so a similar technique would work there by scaling the output. However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. I feel in my gut there must be some way to do it by just manipulating coefficients. -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Ross Bencina Sent: 03 January 2013 17:16 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 4/01/2013 4:05 AM, Thomas Young wrote: Is there a way to modify the bandpass coefficient equations in the cookbook (the one from the analogue prototype H(s) = s / (s^2 + s/Q + 1)) such that the gain of the stopband may be specified? I want to be able I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist so I'm not sure how you're going to define stopband gain in this case :) Maybe start with the peaking filter and scale the output according to your desired stopband gain and then set the peak gain to give 0dB at the peak. peakGain_dB = -stopbandGain_dB (assuming -ve stopbandGain_dB). Does that help? Ross. -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp
Re: [music-dsp] Lerping Biquad coefficients to a flat response
Thanks Nigel - I have just been playing around with the pole/zero plotter (very helpful app for visualising the problem) and thinking about it. You guys are probably right the simplest approach is just to scale the output and using the peaking filter. Additional optional mumblings: I think really there are two 'correct' solutions to manipulating only the coefficients to my ends (that is, generation of coefficients which produce filters interpolating from bandpass to flat): The first is to go from pole/zero to transfer function, basically as you (Nigel) described in your first message - stick the zeros in the centre, poles near the edge of the unit circle and reduce their radii - doing the maths to convert these into the appropriate biquad coefficients. This isn't really feasible for me to do in realtime though. I was trying to do a sort of tricksy workaround by lerping from one set of coefficients to another but on reflection I don't think there is any mathematical correctness there. The second is to have an analogue prototype which somehow includes skirt gain and take the bilinear transform to get the equations for the coefficients. I'm not really very good with the s domain either so I actually wouldn't know how to go about this, but it's what I was originally thinking of. Thanks for the help -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Nigel Redmon Sent: 03 January 2013 18:48 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response Thomas-it's a matter of manipulating the A and Q relationships in the numerator and denominator of the peaking EQ analog prototypes. I'm not as good in thinking in the s domain as the z, so I'd have to plot it out and think-too busy right now, though it's pretty trivial. But just doing the gain adjustment to the existing peaking EQ, as Ross suggested, is trivial. Not much reason to go through the fuss unless you're concerned about adding a single multiply. (To add to the confusion, my peaking implementation is different for gain and boost, so that the EQ remains symmetrical, a la Zolzer). On Jan 3, 2013, at 9:34 AM, Thomas Young thomas.yo...@rebellion.co.uk wrote: I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist Yes I think this is essentially my problem, there are no stop bands per-se just zeros which I was basically trying to lerp away - which I guess isn't really the correct approach. The solution you are proposing would work I believe; along the same lines there is a different bandpass filter in the RBJCB which has a constant stop band gain (or 'skirt gain' as he calls it) and peak gain for the passband - so a similar technique would work there by scaling the output. However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. I feel in my gut there must be some way to do it by just manipulating coefficients. -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Ross Bencina Sent: 03 January 2013 17:16 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 4/01/2013 4:05 AM, Thomas Young wrote: Is there a way to modify the bandpass coefficient equations in the cookbook (the one from the analogue prototype H(s) = s / (s^2 + s/Q + 1)) such that the gain of the stopband may be specified? I want to be able I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist so I'm not sure how you're going to define stopband gain in this case :) Maybe start with the peaking filter and scale the output according to your desired stopband gain and then set the peak gain to give 0dB at the peak. peakGain_dB = -stopbandGain_dB (assuming -ve stopbandGain_dB). Does that help? Ross. -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links
Re: [music-dsp] Lerping Biquad coefficients to a flat response
OK, I had (well, took) time to think: You need to divide the numerator by the gain (A), and multiple the denominator by the gain (aka multiply the numerator by A^2). That will keep the peak at unity. Swap the numerator and denominator if you want the EQ to be symmetric for cut and boost. If you need the BLT worked out, let me know. On Jan 3, 2013, at 11:03 AM, Thomas Young thomas.yo...@rebellion.co.uk wrote: Thanks Nigel - I have just been playing around with the pole/zero plotter (very helpful app for visualising the problem) and thinking about it. You guys are probably right the simplest approach is just to scale the output and using the peaking filter. Additional optional mumblings: I think really there are two 'correct' solutions to manipulating only the coefficients to my ends (that is, generation of coefficients which produce filters interpolating from bandpass to flat): The first is to go from pole/zero to transfer function, basically as you (Nigel) described in your first message - stick the zeros in the centre, poles near the edge of the unit circle and reduce their radii - doing the maths to convert these into the appropriate biquad coefficients. This isn't really feasible for me to do in realtime though. I was trying to do a sort of tricksy workaround by lerping from one set of coefficients to another but on reflection I don't think there is any mathematical correctness there. The second is to have an analogue prototype which somehow includes skirt gain and take the bilinear transform to get the equations for the coefficients. I'm not really very good with the s domain either so I actually wouldn't know how to go about this, but it's what I was originally thinking of. Thanks for the help -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Nigel Redmon Sent: 03 January 2013 18:48 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response Thomas-it's a matter of manipulating the A and Q relationships in the numerator and denominator of the peaking EQ analog prototypes. I'm not as good in thinking in the s domain as the z, so I'd have to plot it out and think-too busy right now, though it's pretty trivial. But just doing the gain adjustment to the existing peaking EQ, as Ross suggested, is trivial. Not much reason to go through the fuss unless you're concerned about adding a single multiply. (To add to the confusion, my peaking implementation is different for gain and boost, so that the EQ remains symmetrical, a la Zolzer). On Jan 3, 2013, at 9:34 AM, Thomas Young thomas.yo...@rebellion.co.uk wrote: I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist Yes I think this is essentially my problem, there are no stop bands per-se just zeros which I was basically trying to lerp away - which I guess isn't really the correct approach. The solution you are proposing would work I believe; along the same lines there is a different bandpass filter in the RBJCB which has a constant stop band gain (or 'skirt gain' as he calls it) and peak gain for the passband - so a similar technique would work there by scaling the output. However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. I feel in my gut there must be some way to do it by just manipulating coefficients. -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Ross Bencina Sent: 03 January 2013 17:16 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 4/01/2013 4:05 AM, Thomas Young wrote: Is there a way to modify the bandpass coefficient equations in the cookbook (the one from the analogue prototype H(s) = s / (s^2 + s/Q + 1)) such that the gain of the stopband may be specified? I want to be able I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist so I'm not sure how you're going to define stopband gain in this case :) Maybe start with the peaking filter and scale the output according to your desired stopband gain and then set the peak gain to give 0dB at the peak. peakGain_dB = -stopbandGain_dB (assuming -ve stopbandGain_dB). Does that help? Ross. -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http
Re: [music-dsp] Lerping Biquad coefficients to a flat response
Well, you're already working with rbj's equations, so just multiple the numerator coefficients by A^2... On Jan 3, 2013, at 1:05 PM, Nigel Redmon earle...@earlevel.com wrote: OK, I had (well, took) time to think: You need to divide the numerator by the gain (A), and multiple the denominator by the gain (aka multiply the numerator by A^2). That will keep the peak at unity. Swap the numerator and denominator if you want the EQ to be symmetric for cut and boost. If you need the BLT worked out, let me know. On Jan 3, 2013, at 11:03 AM, Thomas Young thomas.yo...@rebellion.co.uk wrote: Thanks Nigel - I have just been playing around with the pole/zero plotter (very helpful app for visualising the problem) and thinking about it. You guys are probably right the simplest approach is just to scale the output and using the peaking filter. Additional optional mumblings: I think really there are two 'correct' solutions to manipulating only the coefficients to my ends (that is, generation of coefficients which produce filters interpolating from bandpass to flat): The first is to go from pole/zero to transfer function, basically as you (Nigel) described in your first message - stick the zeros in the centre, poles near the edge of the unit circle and reduce their radii - doing the maths to convert these into the appropriate biquad coefficients. This isn't really feasible for me to do in realtime though. I was trying to do a sort of tricksy workaround by lerping from one set of coefficients to another but on reflection I don't think there is any mathematical correctness there. The second is to have an analogue prototype which somehow includes skirt gain and take the bilinear transform to get the equations for the coefficients. I'm not really very good with the s domain either so I actually wouldn't know how to go about this, but it's what I was originally thinking of. Thanks for the help -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Nigel Redmon Sent: 03 January 2013 18:48 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response Thomas-it's a matter of manipulating the A and Q relationships in the numerator and denominator of the peaking EQ analog prototypes. I'm not as good in thinking in the s domain as the z, so I'd have to plot it out and think-too busy right now, though it's pretty trivial. But just doing the gain adjustment to the existing peaking EQ, as Ross suggested, is trivial. Not much reason to go through the fuss unless you're concerned about adding a single multiply. (To add to the confusion, my peaking implementation is different for gain and boost, so that the EQ remains symmetrical, a la Zolzer). On Jan 3, 2013, at 9:34 AM, Thomas Young thomas.yo...@rebellion.co.uk wrote: I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist Yes I think this is essentially my problem, there are no stop bands per-se just zeros which I was basically trying to lerp away - which I guess isn't really the correct approach. The solution you are proposing would work I believe; along the same lines there is a different bandpass filter in the RBJCB which has a constant stop band gain (or 'skirt gain' as he calls it) and peak gain for the passband - so a similar technique would work there by scaling the output. However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. I feel in my gut there must be some way to do it by just manipulating coefficients. -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Ross Bencina Sent: 03 January 2013 17:16 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 4/01/2013 4:05 AM, Thomas Young wrote: Is there a way to modify the bandpass coefficient equations in the cookbook (the one from the analogue prototype H(s) = s / (s^2 + s/Q + 1)) such that the gain of the stopband may be specified? I want to be able I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist so I'm not sure how you're going to define stopband gain in this case :) Maybe start with the peaking filter and scale the output according to your desired stopband gain and then set the peak gain to give 0dB at the peak. peakGain_dB = -stopbandGain_dB (assuming -ve stopbandGain_dB). Does that help? Ross. -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http
Re: [music-dsp] Lerping Biquad coefficients to a flat response
Glad I read this again—brain thought one thing, and fingers typed another—multiply the denominator by A^2, not numerator. Oh, and for cut…it depends on if you want symmetrical response or not, but if you do, just swap a and b coefficients (yes, after multiplying by the A^2 factor so it ends up on top) On Jan 3, 2013, at 1:20 PM, Nigel Redmon earle...@earlevel.com wrote: Well, you're already working with rbj's equations, so just multiple the numerator coefficients by A^2... On Jan 3, 2013, at 1:05 PM, Nigel Redmon earle...@earlevel.com wrote: OK, I had (well, took) time to think: You need to divide the numerator by the gain (A), and multiple the denominator by the gain (aka multiply the numerator by A^2). That will keep the peak at unity. Swap the numerator and denominator if you want the EQ to be symmetric for cut and boost. If you need the BLT worked out, let me know. On Jan 3, 2013, at 11:03 AM, Thomas Young thomas.yo...@rebellion.co.uk wrote: Thanks Nigel - I have just been playing around with the pole/zero plotter (very helpful app for visualising the problem) and thinking about it. You guys are probably right the simplest approach is just to scale the output and using the peaking filter. Additional optional mumblings: I think really there are two 'correct' solutions to manipulating only the coefficients to my ends (that is, generation of coefficients which produce filters interpolating from bandpass to flat): The first is to go from pole/zero to transfer function, basically as you (Nigel) described in your first message - stick the zeros in the centre, poles near the edge of the unit circle and reduce their radii - doing the maths to convert these into the appropriate biquad coefficients. This isn't really feasible for me to do in realtime though. I was trying to do a sort of tricksy workaround by lerping from one set of coefficients to another but on reflection I don't think there is any mathematical correctness there. The second is to have an analogue prototype which somehow includes skirt gain and take the bilinear transform to get the equations for the coefficients. I'm not really very good with the s domain either so I actually wouldn't know how to go about this, but it's what I was originally thinking of. Thanks for the help -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Nigel Redmon Sent: 03 January 2013 18:48 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response Thomas-it's a matter of manipulating the A and Q relationships in the numerator and denominator of the peaking EQ analog prototypes. I'm not as good in thinking in the s domain as the z, so I'd have to plot it out and think-too busy right now, though it's pretty trivial. But just doing the gain adjustment to the existing peaking EQ, as Ross suggested, is trivial. Not much reason to go through the fuss unless you're concerned about adding a single multiply. (To add to the confusion, my peaking implementation is different for gain and boost, so that the EQ remains symmetrical, a la Zolzer). On Jan 3, 2013, at 9:34 AM, Thomas Young thomas.yo...@rebellion.co.uk wrote: I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist Yes I think this is essentially my problem, there are no stop bands per-se just zeros which I was basically trying to lerp away - which I guess isn't really the correct approach. The solution you are proposing would work I believe; along the same lines there is a different bandpass filter in the RBJCB which has a constant stop band gain (or 'skirt gain' as he calls it) and peak gain for the passband - so a similar technique would work there by scaling the output. However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. I feel in my gut there must be some way to do it by just manipulating coefficients. -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Ross Bencina Sent: 03 January 2013 17:16 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 4/01/2013 4:05 AM, Thomas Young wrote: Is there a way to modify the bandpass coefficient equations in the cookbook (the one from the analogue prototype H(s) = s / (s^2 + s/Q + 1)) such that the gain of the stopband may be specified? I want to be able I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist so I'm not sure how you're going to define stopband gain in this case :) Maybe start with the peaking filter and scale the output
Re: [music-dsp] Lerping Biquad coefficients to a flat response
sigh…hopefully my last post on this… Sorry, I looked at rbi's peak spec and it is symmetrical—I was thinking of his shelving filters, which need to be inverted for symmetry. So just multiply the denominator coefficients by A^2 and you're done. On Jan 3, 2013, at 2:02 PM, Nigel Redmon earle...@earlevel.com wrote: Glad I read this again—brain thought one thing, and fingers typed another—multiply the denominator by A^2, not numerator. Oh, and for cut…it depends on if you want symmetrical response or not, but if you do, just swap a and b coefficients (yes, after multiplying by the A^2 factor so it ends up on top) On Jan 3, 2013, at 1:20 PM, Nigel Redmon earle...@earlevel.com wrote: Well, you're already working with rbj's equations, so just multiple the numerator coefficients by A^2... On Jan 3, 2013, at 1:05 PM, Nigel Redmon earle...@earlevel.com wrote: OK, I had (well, took) time to think: You need to divide the numerator by the gain (A), and multiple the denominator by the gain (aka multiply the numerator by A^2). That will keep the peak at unity. Swap the numerator and denominator if you want the EQ to be symmetric for cut and boost. If you need the BLT worked out, let me know. On Jan 3, 2013, at 11:03 AM, Thomas Young thomas.yo...@rebellion.co.uk wrote: Thanks Nigel - I have just been playing around with the pole/zero plotter (very helpful app for visualising the problem) and thinking about it. You guys are probably right the simplest approach is just to scale the output and using the peaking filter. Additional optional mumblings: I think really there are two 'correct' solutions to manipulating only the coefficients to my ends (that is, generation of coefficients which produce filters interpolating from bandpass to flat): The first is to go from pole/zero to transfer function, basically as you (Nigel) described in your first message - stick the zeros in the centre, poles near the edge of the unit circle and reduce their radii - doing the maths to convert these into the appropriate biquad coefficients. This isn't really feasible for me to do in realtime though. I was trying to do a sort of tricksy workaround by lerping from one set of coefficients to another but on reflection I don't think there is any mathematical correctness there. The second is to have an analogue prototype which somehow includes skirt gain and take the bilinear transform to get the equations for the coefficients. I'm not really very good with the s domain either so I actually wouldn't know how to go about this, but it's what I was originally thinking of. Thanks for the help -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Nigel Redmon Sent: 03 January 2013 18:48 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response Thomas-it's a matter of manipulating the A and Q relationships in the numerator and denominator of the peaking EQ analog prototypes. I'm not as good in thinking in the s domain as the z, so I'd have to plot it out and think-too busy right now, though it's pretty trivial. But just doing the gain adjustment to the existing peaking EQ, as Ross suggested, is trivial. Not much reason to go through the fuss unless you're concerned about adding a single multiply. (To add to the confusion, my peaking implementation is different for gain and boost, so that the EQ remains symmetrical, a la Zolzer). On Jan 3, 2013, at 9:34 AM, Thomas Young thomas.yo...@rebellion.co.uk wrote: I'm pretty sure that the BLT bandpass ends up with zeros at DC and nyquist Yes I think this is essentially my problem, there are no stop bands per-se just zeros which I was basically trying to lerp away - which I guess isn't really the correct approach. The solution you are proposing would work I believe; along the same lines there is a different bandpass filter in the RBJCB which has a constant stop band gain (or 'skirt gain' as he calls it) and peak gain for the passband - so a similar technique would work there by scaling the output. However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. I feel in my gut there must be some way to do it by just manipulating coefficients. -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Ross Bencina Sent: 03 January 2013 17:16 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Lerping Biquad coefficients to a flat response On 4/01/2013 4:05 AM, Thomas Young wrote: Is there a way to modify the bandpass coefficient equations in the cookbook (the one from the analogue
Re: [music-dsp] Lerping Biquad coefficients to a flat response
Hi Thomas, Replying to both of your messages at once... On 4/01/2013 4:34 AM, Thomas Young wrote: However I was hoping to avoid scaling the output since if I have to do that then I might as well just change the wet/dry mix with the original signal for essentially the same effect and less messing about. Someone else might correct me on this, but I'm not sure that will get you the same effect. Your proposal seems to be based on the assumption that the filter is phase linear and 0 delay (ie that the phases all line up between input and filtered version). That's not the case. In reality you'd be mixing the phase-warped and delayed (filtered) signal with the original-phase signal. I couldn't tell you what the frequency response would look like, but probably not as good as just scaling the peaking filter output. On 4/01/2013 6:03 AM, Thomas Young wrote: Additional optional mumblings: I think really there are two 'correct' solutions to manipulating only the coefficients to my ends (that is, generation of coefficients which produce filters interpolating from bandpass to flat): The first is to go from pole/zero to transfer function, basically as you (Nigel) described in your first message - stick the zeros in the centre, poles near the edge of the unit circle and reduce their radii - doing the maths to convert these into the appropriate biquad coefficients. This isn't really feasible for me to do in realtime though. I was trying to do a sort of tricksy workaround by lerping from one set of coefficients to another but on reflection I don't think there is any mathematical correctness there. The second is to have an analogue prototype which somehow includes skirt gain and take the bilinear transform to get the equations for the coefficients. I'm not really very good with the s domain either so I actually wouldn't know how to go about this, but it's what I was originally thinking of. In the end you're going to have a set of constraints on the frequency response and you need to solve for the coefficients. You can do that in the s domain and BLT or do it directly in the z domain. See the stuck with filter design thread from November 17, 2012 for a nice discussion and links to background reading. There is only a difference of scale factors between your constraints and the RBJ peaking filter constraints so you should be able to use them with minor modifications (as Nigel suggests, although I didn't take the time to review his result). Assuming that you want the gain at DC and nyquist to be equal to your stopband gain then this is pretty much equivalent to the RBJ coefficient formulas except that Robert computed them under the requirement of unity gain at DC and Nyquist, and some specified gain at cf. You want unity gain at cf and specified gain at DC and Nyquist. This seems to me to just be a direct reinterpretation of the gain values. You should be able to propagate the needed gain values through Robert's formulas. Cheers, Ross. -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp