Frequency response measurements by audio signal FFT

I am trying to measure the frequency response of different audio canals, e.g. tubes, hollow pipes etc.

My experimental setup looks like this: I generate an audio signal with a loudspeaker (Visaton WS 17 E 4 Ohm, datasheet: Datasheet loudspeaker which then passes through my device under test (e.g. the tube) and is then measured by a microphone (with a flat frequency response).

Unfortunately the output of my loudspeaker when measured directly (without the device under test in between) does not show a somewhat flat frequency response, on the contrary I see something like this. To obtain the graph I apply basic FFT to the output data of the microphone.

The input signals I am using are sine sweeps and white noise. Both results in very similar results. The same applies to the audio amplifier I am using, switching to a different one changed nothing. I therefore do not believe these two to be the issue.

I wonder now what I can do to obtain sensible results after the FFT. Do you have an idea how I can either improve the output of my loudspeaker respectively what causes the peaks and valleys in it? Alternatively, is there a way to kind of "subtract" the frequency response mathematically to obtain clean results?

I am very much looking forward to hearing any suggestions because I have already invested a lot of time and I am running out of ideas.

• Random observation: the speaker will behave "better" if you place it in a cabinet (i suggest closed box, with sound deading fluff inside, a few liters volume). Commented Jul 4, 2023 at 20:38

On a high level, your setup is:

$$X \rightarrow \fbox{H} \xrightarrow{X.H} \fbox{DUT} \xrightarrow{X.H.DUT} \fbox{Mic} \rightarrow Y_{measured}$$

where $$H$$ is the loudspeaker response. I'm assuming the $$Mic$$ response is flat.
You therefore need to compensate your measured response $$Y_{measured} = X.H.DUT$$ with the inverse of the loudspeaker response: $$H^{-1}$$

Devil is in the detail, and inverting a transfer function comes with its own set of problems, but your loudspeaker-only measurement looks "flat" enough to at least try that simple approach. Simply multiply your measured response $$Y_{measured}$$ by $$H^{-1}$$:

$$X \rightarrow \fbox{H} \xrightarrow{X.H} \fbox{DUT} \xrightarrow{X.H.DUT} \fbox{Mic} \rightarrow Y_{measured} \rightarrow \fbox{1/H} \xrightarrow{X.DUT} Y_{compensated}$$ or, in transfer function form: $$Y_{compensated} = X.H.DUT.H^{-1} = X.DUT$$

• Thanks for your answer. Absolutely, you have summarised what I was trying to explain in a more mathematical way. The microphone does indeed have a fairly flat response, it is small enough to be negligible in comparison to the loudspeaker.To obtain H−1, I have to divide the measured response by the original signal and then aplly an inverse FFT to it, correct? Commented Jul 4, 2023 at 10:29
• @Scaty no, you have $H$ already (the loudspeaker-only response). Just compute $H^{-1} = 1/H$ then multiply the DUT response by that, effectively compensating for $H$
– Jdip
Commented Jul 4, 2023 at 10:36
• Of course, as my input signal is supposed to have a flat response, my measurement should already be H. Sometimes when you think about a problem for too long, you don't see the simplest contexts anymore. I will try this now and hopefully it will solve or at least significantly attenuate my problems. Commented Jul 4, 2023 at 10:51