What's the easiest / fastest way to get a frequency response for a filter if you don't have the transfer function?

What’s the easiest / fastest way to get a frequency response for a filter if you don’t have the transfer function?

White noise and measure output with FFT? Sine sweep and measure output? Chirp?

Needs to look good enough for frequency response on UI, so doesn’t need to be perfect. Needs to be fast enough it updates when user turns dial.

Send in an impulse and perform a DFT of the output. That gives you the frequency response. No need for white noise or sweep as you wont have additive noise in the measurement as it’s purely digital.

Sweep is only useful if you measure analog systems with additive noise, like room impulse responses. That helps to get enough energy into the system to measure it and handle non-linear effects in the measurement equipment.

2 Likes

Thanks, it’s almost working. Frequency response looks correct, but the level doesn’t seem to be correct. The bigger the FFT I use, the lower dB levels I’m getting. I assume I need to correct for FFT size, but I must be doing something wrong.

You just want to divide by the FFT Size – it will normalize back to correct amplitudes – then you can do Decibels::ampToDecibels and map it to your desired DB range on screen

I’m pretty sure my FFT is working correctly since I use it elsewhere. I think my actual issue is I don’t know the frequency content of the impulse signal. Should I run the DFT on the impulse, run the impulse through my filter, run the DFT again. Then compare the dB levels before and after to get the frequency response?

I should preface I haven’t done this just read it a bunch of times — but no the theory is you know the response of the impulse — it’s totally flat at 0dB, so the result of passing it through the filter is the filters response for each frequency.

1: Make impulse — buffer size X first sample 1 all other samples 0

2: Filter

3: Forward transform

4: Normalize each mag by FFT size

5: covert that mag to DB for plotting the response

1 Like

Yeah after a quick google I might be wrong on the construction of the impulse actually and the levels of the frequencies therein, but I think it’s still the theory

This is working pretty well, until I turn up the resonance, then it gets pretty unstable at low frequency. Any thoughts on ways to fix that?

i have used this technique. in order to get a good resolution in the lowend your filtered impulse just needs to be long enough, up to 1sec, if you want all frequencies down to 1hz. if you want to go even lower the length needs to approach infinity

Out of curiosity did the impulse work at sample 0 or did you need to position the 1 in the center of your buffer?

I have it at position 0.

1 Like