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