0
votes

I generate the sound using matlab and then play it over computer's speaker, meanwhile I record the sound using iphone, at last i send the 'record.wav' file to computer to analyze it. But here I found that the amplitude of low frequency much is lower than that of high frequency.

The sound generation code looks like A*sin(2*pi*697*(0:N-1)/44100)+A*sin(2*pi*1209*(0:N-1)/44100 if I want to generate a dial tone for number 1, N is the length that i want to generate and 44100 is the sampling frequency.

Then I want to use FFT to analyze the frequency of the sound and plot the FFT output. Though I get the correct frequency I want, the amplitude looks different, which puzzles me a lot.

So, what happened? Why are the two amplitudes different?

[temp,fs] = audioread('record.wav');
[P1,f] = fft_recorder(temp,fs);

function [P1,f] = fft_recorder(array,fs)
    array = fft(array);
    P2 = abs(array/length(array));
    P1 = P2(1:length(array)/2+1);
    P1(2:end-1) = 2*P1(2:end-1);
    f = fs*(0:(length(array)/2))/length(array);
end

1
What did you expect ? This is what a FFT is supposed to do. There is nothing wrong here. Do you understand what is a FFT ?obchardon
I don't really understand what happened here, did you generate the sound in matlab, then play it over a speaker, record it on the iphone, then analyze it? Maybe the frequency response of the speaker and the microphone attenuated the lower tone.youR.Fate
Hi and welcome to SO. Please read How to Ask. Add your entire code how you generate your signal and how you are processing it. Otherwise it will be very difficult to help youIrreducible

1 Answers

1
votes

The speaker outputting the sound, and the room you are in (due to multipath reflections and resonances), most likely do not have a flat frequency response over that frequency range. Any mechanical resonances due to contact with the speaker or the iPhone will also change the received audio level by different amounts at different frequencies. (The iPhone's microphone may be closer to having a flat frequency response, but not perfectly.) So some frequencies will be recorded as stronger than others, even with your variable A set to a constant.

Try testing one frequency at at time over your desired frequency range, and measure the response of your channel. The frequency response curve might even change by a large amount when changing the position of the speaker, microphone, or other large objects in the room.