Reson~ with sharp Q has long attack/decay. Why?
I’m trying to extract information about a few specific frequencies from an audio stream.
The easiest way, I thought, was to use a reson~ object at the desired frequency with an extremely high Q, say 10,000. However, I noticed that by doing so, I lose temporal resolution: if the input signal abruptly switches away from the resonant frequency, it takes output from reson~ a long time to catch up.
Why is this?
I’m attaching a patch that shows this effect clearly. Use the preset to pre-load the reson~ filter with the correct settings, then use the messages attached to the cycle~ object to jump between frequencies.
I’m not attached to reson, so if there’s a better way to isolate specific frequencies very quickly (say with a +/- 25hz bandwidth and 100ms response time) I’m all ears.
----------begin_max5_patcher---------- 766.3oc2XssbaBCD8Y7WACO65QWfXneA8enSlLxfriRAgCH25jLIe6EcArSr 4ZXHz9hrYYs18b1KZkeYgkylzizbG6ua+SaKqWVXYoDIEXYd1xIgbLLljqTy IgJnYu4rT+p8DQ38L9t6xngB81fwfUfk1Xf5Ce0JDuBXeq42vOjv3wTgZ+fF grH0tmt4guAANmzL8f3ippEIdZOUaPmswojBieq70utXgbY4ngFnmB.dCEMA SGX3z+TXwR6InGUXn.Ug+xNWjlQsAMfz.E1zq9PENCpCmnKwoGpbu2lxEbRh BPN+fF+apfER5IM3TYX41kydV8BIyO.hYyAgHk2J1uQshpV6bL1C1Szsgv2M vX7gjMzrFfBDcFVzYs0GGuBVbCFRbDUGRYbgyxJ.Odgz8Yzbpn0PpgMZKe9J 7.55.0sNfV5PUP98BprqV7cQDAorsaED0VSFeO4SExNoq2RSPBI22hVEEpa9 FQZJELqTBViRPcq4J8.0nG.7AECjutLCrDn.cdrL3MnLZ5yQjvFaAq8By4Jt dkqct0j+0CkCIsKLMIgxEWzi8wF7eWSGE2phwdlJhWOjRRv3UrUGpCKDRyr2 lQebUSAPcsHBp9X8M8m.7moDvNBqoiUvq0COnGa.60efG7EC7xtB0CQc8nI4 9l92m0ELpm2T17Z7Owocp.edZ9PN5E9eCU.OOweHTA5eDpnlYtKNjOk2gC0P q0LTvJulXH2qvP3Qcd6b1NNIdTolDZdNYG8BtQN9QCLCxWk6nach0GVrtOWD Y9dOjZYjVnDSmEMk3h5MkfmuTRM0OgOEFSeSMBZ6EQkC4C58kVgeU0PJcbhY 7O9munPoT964r7zCYgk1wDRsOgyHZtfwIBVwsbOoC7c5bOKJhxOe9fDVz9zh g3MtPMSu2UOxa14QpaI0lKI6iZCmNeB1UeBMc9Dnq9Ddx7oNSSSX5TWp47mm tzzkf60khNzz1YpKISd8zmBTir4qNs4yECC5p2AmUUeAyuLcH3S3SEO75h+B UWsw0C -----------end_max5_patcher-----------
normal digital time domain filters are made of delay units. to obtain a very steep rolloff, these filters either need a lot of delay units (i.e. a very long filter kernel) or you use recursive filters, that have a feedback path. reson~ is one of those. so, if you set the resonance very high to make the filter bandwidth small, the feedback coefficients are set high and the filter starts to resonate (to ring).
if you want to reduce the ringing and still have a steep rolloff you could try to put a few of these in series.
in the example below, i used a 4 biquad~s in bandpass mode and it seems to work ok.
if you want to find out, if a signal component is present (and not necessarily filter the signal) you could look into goertzel filters. these are used in DTMF signaling. if you are on osx and want to try it out, you can find an goertzel filter external here http://www.esbasel.ch/Downloads/MaxMSP-Objects.htm
----------begin_max5_patcher---------- 961.3oc2YssrZBCE8Y8qvgG6XcxUtzuf9EzW5zoSDxQoECVI1ys432dIIPky QQCVLxoufgPfr1q8ZuyNwmGOxad9C7BuIeZxWmLZzyiGMR2kpiQU2OxaE6g3 LVgdXdw4qVwERuolmI4OH08OmIRtOMQtr9IhsqREYbo90fUcllnGb97e7QJp dj2kKjB1Jt9QeguIgIXM9J4ak0eFPUuqYx3kohEeeCOVZPuOBMCLcBFDo9IL PcEV1dx2ZLKEoOomEHXFP06KiGqtL0RaWvuuD4GX5LYdxbaMaLs6lMrcyFA8 UVJI.ns9nCLaymQ93Zt4E775SF4tr7RnVi54Khyyx2XlHvr.+PeTvzxVgADJ T0.RQQjxVvFH7rLle2YLz4YrHsDwO37LVoQxJE7ZM9BOGHnVyY+jsZ8tIPD3 n5JzgrDgbUzUDTKgSsvRCtvMTuRKvvPESfvzAP31YscbuF3Ta69ZIAE8eRfC lbUTHffAWfy7zeskkr6nDi+gDCBdTh4y7reykowW.0.f5nFCCE5OidNpoHcg fk0B2fukbC5JwM9z2+bC3JwMUqEca3ltk5EF0qodiLE0pqwiBFfId+vNUwc1 lxEFzuobAZgAAqyqPnmmeNo93xHlUbIeyNq0G9c2JoTiUpKLCoWXIhXyBK2r LAP5UJS.L58Sl.RulIfVsQOP3sOWPGIBTuRD9QlRve+wCv9UPXpl58GODzux ASwACBZHMqbofEaXqWd7LkgGY26G2fCZ2fwH39yu.GgMaKEbJSNKsPaw+0zO Qi5wlJZr0D1VYd4WsoCUXr1W4jK3RSuUGDTI9J8FSUMTtEHv3d16oN0kKZ4q tsXbT2WGBp4an4X.L0ko55prVL+oDV7NaqsJrymbZk+fD1n7I00Kj4KJXK3G T4fZRr0D56pFBg6OrFS0SvfK3HavWXcgsPHcgQv8ccTH+8ThIyoCojVJtL9w 3L9Nc9Aq2HQOyKQ5P.HnYXceUdodLk4UEu8+aQiCU+ulxJx2tItddpL1I6gR BuPlJXxzbQiwnNLqFCZYZRBWzL9eUZx57xj5E0w9A5ZnCq1zz96ZI52ZvFYA ZgcCr+qPxFDQGbPJxoHJvBDozX9tiifVBIp6fDxRHE3LHolMx4D2DmJkH1Fu AcmiyF4cnaSAXKjbGKgsww41zRzgGjf1fI0YgOvB4zPxchIjM4JQtsRf23UZ ASngmqC4TWGwVOmCUSVUDmuS8bXaT3XrawjM9NraU3XaRXhcquiXEO41MEXk FmPFdX5MkxzMLUdyKi+CrqjUwA -----------end_max5_patcher-----------
Volker, thanks very much for the explanation and patch. I’ve only been able to give it a cursory look but the response seems to be much faster. Thanks. I’ve also downloaded your goertzel filter; my end goal with this is actually quite similar to DTMF recognition.
thanks alot for the goertzel filter !
I have one question about its frequency resolution:
Are the frequency bins centered on multiples of sr/blocksize like with DFT ?
Is the output of the goertzel filter any different from the magnitude of the coresponding of a "complete" DFT ?
nochmals vielen Dank,
Umm a q of 10,000 seems excessive to me > at 1000Hz this gives a bandwidth of 0.1 Hz . . .
Is this what you were after? for 25Hz Bandwidth at 1kHz Q would be 40 . . . .
> Is the output of the goertzel filter any different from the magnitude of the
> coresponding of a "complete" DFT ?
no, there shouldn’t be any difference, except that the goertzel output is already scaled to 0 – 1 range. also in windowing (gaussian) mode i tried to rescale the values, so they have the same range as with no windowing.
(btw. i just uploaded a new version where this rescaling value is slightly more accurate).
> Are the frequency bins centered on multiples of sr/blocksize like with DFT ?
as i understand it there are no ‘bins’ involved, so you can look for any kind of frequency.
but you are right, you get the most accurate/stable readings, for frequencies that are multiples of sr/blocksize.
maybe one could think of it, as if the ‘in between freqs’ are more or less perfect interpolations of the magnitudes of two neighbouring ‘bin freqs’.
as i understand it, the goertzel filter is a simple iir filter, you could even build one with a biquad~.
however i was interested in accurate readings, that’s why i ended up making an external.
> thanks alot for the goertzel filter !
you are welcome!
Forums > MaxMSP