I'm currently trying to calculate the frequency response of a microphone for iphone / mic. I play the sine on the speaker, record it through the microphone and try to get the frequency response. the ultimate goal is the ability to multiply FR by any sound so that the sound looks like an iphones / mic speaker.
My code is:
//apply window function vDSP_vmul(sineSweepMic,1,hammingWindow,1,sineSweepMic,1,n); vDSP_vmul(sineSweepFile,1,hammingWindow,1,sineSweepFile,1,n); //put both signals in complex arrays vDSP_ctoz((DSPComplex *)sineSweepMic, 2, &fftSineSweepMic, 1, nOver2); vDSP_ctoz((DSPComplex *)sineSweepFile, 2, &fftSineSweepFile, 1, nOver2); //fft of both file and mic sweeps vDSP_fft_zrip(fftSetup, &fftSineSweepFile, 1, log2n, FFT_FORWARD); vDSP_fft_zrip(fftSetup, &fftSineSweepMic, 1, log2n, FFT_FORWARD); //back to interleaved vDSP_ztoc(&fftSineSweepFile, 1, (COMPLEX *)sineSweepFile, 2, nOver2); vDSP_ztoc(&fftSineSweepMic, 1, (COMPLEX *)sineSweepMic, 2, nOver2); //divide mic-sweep by file-sweep to create frequency response vDSP_vdiv(sineSweepFile, 1, sineSweepMic, 1, frequencyResponse, 1, n);
it still works, and when I multiply FR by the initial scan of the file, it sounds like a mic scan.
My problem: this only works for the exact file (sweep) from which FR is generated. As soon as I use FR to change other sounds, music appears, for example, only noise.
i use FR like this (as in the frequency domain, alternating, not complicated, even the same length):
vDSP_vmul(soundToModify, 1, frequencyResponse, 1, soundToModify, 1, n);
My sinusoidal sweep from a file being played on the speaker: 
My recorded sine wave (visible visible low frequencies): 
My sine-sweep file is multiplied in the frequency domain with FR generated as above in the code: 
My goal: in my understanding, the frequency response is information about each frequency, how much it is weakened or amplified by the system (in my example, it is not able to reproduce low frequencies). To get this information, I generate a sound containing each desired frequency (sine sweep), reproducing it and analyzing how each frequency changes, dividing the recorded recorded sweep / sweep of the file (division by code).
When you multiply this FR in the frequency domain by any sound, you need to change the frequency amplitudes to simulate playback in my system, right?
thanks!
UPDATE: in the end, the disadvantage was the lack of complex arithmetic, and both, the sine wave and pink noise worked pretty well, like an impulse to restore the impulse.
to get working code is just complicated - divide the recorded sweep fft data into the original fft scan data.