1
$\begingroup$

I need a speaker to play broadband white noise for my scientific application. I would like to know whether my relative naive implementation is correct or not. The speakers I use have a large frequency range but the response is not flat, so I need to equalize the sound. What I do is the following:

Software used: Matlab 2016a with Psychtoolbox 3 (latest version) for minimum latency playback.

Hardware used: Windows 10 PC (i5, 8 GB RAM), ASUS soundcard (192 KHz), National Instruments DAS card (250 kHz), profesional microphone, speakers, soundproof box.

  • First I generate a randn array of a desired length, with the sampling frequency of the soundcard. The normally distributed random values are properly truncated so they don't exceed +1 or -1, which is the maximum range of the input signal, but also in a way that the gaussian distribution is minimally disrupted.
  • Then I play the sound through the speaker and I record it with the mic and the NI card (at the card's maximum sampling frequency). I discard the beginning and the end of the signal to ensure that I have something stable, and I divide it in chunks of equal length (I discard whatever reminder they may be). After that I calculate the fft for each chunk, I obtain the absolute value, and I average it for all the chunks. As expected, the amplitude profile is not flat.
  • Finally, I generate a new signal in the same way as I did the first time (I could reuse the original, I guess) and I obtain its fft. Then I multiply it point by point with the inverse of the average absolute fft of the recorded signal from the last step, properly interpolated so it has the same number of frequency points, and reflected at the middle frequency so the symmetry is respected. I take the ifft and thus it becomes my equalized signal. When I play and record it, I observe indeed that the frequency response is much flatter than the original signal.

I posted another question that describes the process more extensively. Here I omitted many details to focus just on the equalization part.

$\endgroup$
  • $\begingroup$ the google shortlink (whyever you use a shortlinker?) is 404 not found! $\endgroup$ – Marcus Müller Sep 30 '17 at 13:01
  • $\begingroup$ huh, I'm a bit surprised. In the sense of minimizing efforts, why the aftermarket telephone speakers? Feels like a mismatch to the "scientific application" – these things aren't really known for linearity, are they? $\endgroup$ – Marcus Müller Sep 30 '17 at 13:16
  • $\begingroup$ As far as I've seen they are linear, stable and durable. The size is key for us, and it's difficult to find something similar. The very few options provided from scientific oriented vendors are essentially the same product but they are charged 20 times more. We were actually recommended from one of the people that we used to manage the purchases that we should just buy those cellphone speakers because they perform the same. Not the 'scientific' speakers of that side were actually discontinued. $\endgroup$ – J. R. C. Sep 30 '17 at 13:29
  • $\begingroup$ I meant 'Now', not 'Not', and 'size' not 'side' in the last sentence, sorry. $\endgroup$ – J. R. C. Sep 30 '17 at 13:37
  • $\begingroup$ It would be good to know the length of your signal , and the length of the chunks. You should apply a window function to the chunks, if you are not already. Also you should be suspicious of low-energy bins that result in very large correction gains. These response dips are usually caused by room reflections, and you can't fix reflections with a filter. Most people apply a smoothing function to the gain vector. $\endgroup$ – Bob Oct 1 '17 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.