Hi list,
I am trying to calculate a makeup gain factor for white noise sent into [bp~] and [vcf~] bandpass objects depending on the center frequency and the Q (width) so that it measures the same in dBRMS before and after the filter. I am currently measuring it but am wondering if a.) this has been done before and b.) if there is an analytical solution to it already
Thanks! P
Hi Peter,
On 2020-03-04 11:18, Peter P. wrote:
I am trying to calculate a makeup gain factor for white noise sent into [bp~] and [vcf~] bandpass objects depending on the center frequency and the Q (width) so that it measures the same in dBRMS before and after the filter. I am currently measuring it but am wondering if a.) this has been done before
Not quite the same, but maybe useful: https://lists.puredata.info/pipermail/pd-list/2010-08/082104.html
and b.) if there is an analytical solution to it already
vcf~ code has a gain adjuster in it, but I don't know the theory behind it.
vcf~ aims for an approximate peak gain of 1 (although this is _very_ approximate for low values of Q).
Me, I use Q+1 to normalize filtered white noise. But theory would suggest the output power should be proportional to bandwidth (= f/Q) - with the bandwidth limited to Nyquist frequency - so one would divide by sqrt(min(f/Q, SR/2)) . I'll stick with multiplying by Q+1 for myself :)
Miller
On Wed, Mar 04, 2020 at 12:58:09PM +0000, Claude Heiland-Allen wrote:
Hi Peter,
On 2020-03-04 11:18, Peter P. wrote:
I am trying to calculate a makeup gain factor for white noise sent into [bp~] and [vcf~] bandpass objects depending on the center frequency and the Q (width) so that it measures the same in dBRMS before and after the filter. I am currently measuring it but am wondering if a.) this has been done before
Not quite the same, but maybe useful: https://lists.puredata.info/pipermail/pd-list/2010-08/082104.html
and b.) if there is an analytical solution to it already
vcf~ code has a gain adjuster in it, but I don't know the theory behind it.
Claude
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
vcf~ aims for an approximate peak gain of 1 (although this is _very_ approximate for low values of Q).
Thanks for the info Miller!
Measuring vcf~ with a Q of 5 and noise~ I do get different results depending on the center frequency. For 100Hz the filter output is 26dBRMS softer than its input signal, at 1000Hz it is 16dBRMS softer, and at 10000Hz it is 5dB softer. Raising the Q to 15 softenes all three levels accordingly.
Me, I use Q+1 to normalize filtered white noise.
Is that the way how you do it in vcf~'s code or how you would do it to normalize after bp~?
But theory would suggest the output power should be proportional to bandwidth (= f/Q) - with the bandwidth limited to Nyquist frequency - so one would divide by sqrt(min(f/Q, SR/2)) . I'll stick with multiplying by Q+1 for myself :)
I can't seem to get around the fact that sqrt(f/Q) changes with center frequency, and Q+1 does not. Is that part of the simplification?´
Shouldn't the bandwidth of the filter let the same signal enery pass regardless of center frequency?
Sorry if I skipped this part of my DSP classes...
thanks! P
- Miller Puckette via Pd-list pd-list@lists.iem.at [2020-03-04 16:49]:
vcf~ aims for an approximate peak gain of 1 (although this is _very_ approximate for low values of Q).
Thanks for the info Miller!
Measuring vcf~ with a Q of 5 and noise~ I do get different results depending on the center frequency. For 100Hz the filter output is 26dBRMS softer than its input signal, at 1000Hz it is 16dBRMS softer, and at 10000Hz it is 5dB softer. Raising the Q to 15 softenes all three levels accordingly.
I am attaching the patch I measured this with plus a small sqrt(f/Q) calculation therein.
Measuring vcf~ with a Q of 5 and noise~ I do get different results depending on the center frequency. For 100Hz the filter output is 26dBRMS softer than its input signal, at 1000Hz it is 16dBRMS softer, and at 10000Hz it is 5dB softer. Raising the Q to 15 softenes all three levels accordingly.
Aha - yes, my (Q+!) fix aims to allow changing Q without much affecting the perceived loudness, but doesn't account for varying the center frequency.
To loudness-balance filtered white noise, you'd want to aim to get the same signal power as the noise has in a one-bark-wide band. Above 500Hz this increases linearly with frequency. So you'd want a 10-dB increase in the signal for a 10x increase in center frequency. However, for frequencies below 500hz you'd want the result to be roughly independent of center frequency. So what you're seeing looks OK except that it should be corrected below 500 Hz.
OTOH if you want to balance with the whole of the white-spectrum noise (not just the slice that's in your local bark) then you have to go look at equal-loudness coutours (since in that case we're comparing loudnesses of sounds at different frequencies). At that point I just give up and use my ears :)
Me, I use Q+1 to normalize filtered white noise.
Is that the way how you do it in vcf~'s code or how you would do it to normalize after bp~?
That's how I normalize in the patch. Example (but ignore the Hilbert stuff):
http://msp.ucsd.edu/syllabi/171.20w/patches/7.e.graphing-resonant-filter.pd
But theory would suggest the output power should be proportional to bandwidth (= f/Q) - with the bandwidth limited to Nyquist frequency - so one would divide by sqrt(min(f/Q, SR/2)) . I'll stick with multiplying by Q+1 for myself :)
I can't seem to get around the fact that sqrt(f/Q) changes with center frequency, and Q+1 does not. Is that part of the simplification???
Shouldn't the bandwidth of the filter let the same signal enery pass regardless of center frequency?
Yeah, depends on whether you want to match power ( roughly dividing by sqrt(f/Q) for "reasonable" f/Q values) or "sound good" (as I think Q+1 does fairly well).
Also, the result for white noise isn't necessarily representative of what you get filtering real signals - all sorts of things happen then.
cheers Miller
Sorry if I skipped this part of my DSP classes...
thanks! P
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
I've done a nice job plotting the frequency response of both bp~ and vcf~ and exposing their formulas,
see https://github.com/porres/Live-Electronics-Tutorial/tree/v1.0-beta-17/Exampl...
and https://github.com/porres/Live-Electronics-Tutorial/tree/v1.0-beta-17/Exampl...
Em dom., 8 de mar. de 2020 às 19:59, Miller Puckette via Pd-list < pd-list@lists.iem.at> escreveu:
Measuring vcf~ with a Q of 5 and noise~ I do get different results depending on the center frequency. For 100Hz the filter output is 26dBRMS softer than its input signal, at 1000Hz it is 16dBRMS softer, and at 10000Hz it is 5dB softer. Raising the Q to 15 softenes all three levels accordingly.
Aha - yes, my (Q+!) fix aims to allow changing Q without much affecting the perceived loudness, but doesn't account for varying the center frequency.
To loudness-balance filtered white noise, you'd want to aim to get the same signal power as the noise has in a one-bark-wide band. Above 500Hz this increases linearly with frequency. So you'd want a 10-dB increase in the signal for a 10x increase in center frequency. However, for frequencies below 500hz you'd want the result to be roughly independent of center frequency. So what you're seeing looks OK except that it should be corrected below 500 Hz.
OTOH if you want to balance with the whole of the white-spectrum noise (not just the slice that's in your local bark) then you have to go look at equal-loudness coutours (since in that case we're comparing loudnesses of sounds at different frequencies). At that point I just give up and use my ears :)
Me, I use Q+1 to normalize filtered white noise.
Is that the way how you do it in vcf~'s code or how you would do it to normalize after bp~?
That's how I normalize in the patch. Example (but ignore the Hilbert stuff):
http://msp.ucsd.edu/syllabi/171.20w/patches/7.e.graphing-resonant-filter.pd
But theory would suggest the output power should be proportional to bandwidth (= f/Q) - with the bandwidth limited to Nyquist frequency - so one would divide by sqrt(min(f/Q, SR/2)) . I'll stick with multiplying by Q+1 for myself :)
I can't seem to get around the fact that sqrt(f/Q) changes with center frequency, and Q+1 does not. Is that part of the simplification???
Shouldn't the bandwidth of the filter let the same signal enery pass regardless of center frequency?
Yeah, depends on whether you want to match power ( roughly dividing by sqrt(f/Q) for "reasonable" f/Q values) or "sound good" (as I think Q+1 does fairly well).
Also, the result for white noise isn't necessarily representative of what you get filtering real signals - all sorts of things happen then.
cheers Miller
Sorry if I skipped this part of my DSP classes...
thanks! P
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
I've done a nice job plotting the frequency response of both bp~ and vcf~ and exposing their formulas,
Thank you! In what way will this help the makeup gain calculation?
best, P
I'm thinking that being able to plot the frequency response according to filter coefficients will allow you to adjust the gain coefficient and see how the plot responds. But I didn't really think it through...
Em ter., 10 de mar. de 2020 às 18:37, Peter P. peterparker@fastmail.com escreveu:
- Alexandre Torres Porres porres@gmail.com [2020-03-10 19:59]:
I've done a nice job plotting the frequency response of both bp~ and vcf~ and exposing their formulas,
Thank you! In what way will this help the makeup gain calculation?
best, P
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Hi again,
On 04/03/2020 12:58, Claude Heiland-Allen wrote:
On 2020-03-04 11:18, Peter P. wrote:
I am trying to calculate a makeup gain factor for white noise sent into [bp~] and [vcf~] bandpass objects depending on the center frequency and the Q (width) so that it measures the same in dBRMS before and after the filter. I am currently measuring it but am wondering if b.) if there is an analytical solution to it already
For an un-normalized 2-pole bandpass filter as depicted at [1], I think the overall gain of the filter for white noise input is
sqrt ( integral from 0 to pi of |1/((exp(it) - (1-b)exp(iw))(exp(it) - (1-b)exp(-iw)))|^2 dt )
I tried it on Wolfram Alpha but it didn't succeed (time limit exceeded). Probably there is no simple closed-form solution?
Then you need to factor in how bp~ [2] and vcf~ [3] convert f and q into w and b, as well as their custom gain factors.
I attached an example with simple numerical integration (using Pd dsp with bang to switch~), seems to work ok (but may be unreliable if q is too high), you could combine with automation for -batch and use that to generate data for surface fitting software? I may try that later...
I think I made a mistake though: I used vcf~'s f q -> w b calculations, but now realized that maybe vcf~ has 1 (complex) pole and bp~ has 2 (a conjugate pair)?
As a bonus, the patch includes a normalized log-log spectrum graph calculated in DSP using tabsend~/tabreceive~ and order forcing.
[1] http://msp.ucsd.edu/techniques/latest/book-html/node143.html [2] https://github.com/pure-data/pure-data/blob/e2ef8158e83900734d263a3fda343a47... [3] https://github.com/pure-data/pure-data/blob/e2ef8158e83900734d263a3fda343a47...
Hi, Peter.
If useful, Zavalishin has a normalised BP in a 2p2z state-variable filter based on the bilinear transform integrator (zero-delay feedback) and the output seems to be consistent. See 4.4: https://www.native-instruments.com/fileadmin/ni_media/downloads/pdf/VAFilter... .
Attached here you'll find the Faust code for the filter; you can paste that on https://faust.grame.fr/ide/ and export a PD external. Unfortunately, you can't give options to the compiler in the web app so it will be single-precision, but it should still work without extreme settings.
Inputs are CF, Q, K (shelving boost, linear amp), input signal. Outputs are LP, HP, BP, BP (normalised), LShelf, HS, BS, notch, peak AP.
Dario
On Wed, 4 Mar 2020 at 12:21, Peter P. peterparker@fastmail.com wrote:
Hi list,
I am trying to calculate a makeup gain factor for white noise sent into [bp~] and [vcf~] bandpass objects depending on the center frequency and the Q (width) so that it measures the same in dBRMS before and after the filter. I am currently measuring it but am wondering if a.) this has been done before and b.) if there is an analytical solution to it already
Thanks! P
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list