[PD] bandpass makeup gain formula?

Claude Heiland-Allen claude at mathr.co.uk
Wed Mar 4 18:32:57 CET 2020


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/e2ef8158e83900734d263a3fda343a47ed0c9e3a/src/d_filter.c#L284-L301
[3] 
https://github.com/pure-data/pure-data/blob/e2ef8158e83900734d263a3fda343a47ed0c9e3a/src/d_osc.c#L386-L447


Claude
-- 
https://mathr.co.uk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: unity-band-pass-example.pd
Type: text/x-puredata
Size: 8769 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20200304/5295a7a3/attachment-0001.bin>


More information about the Pd-list mailing list