file1='Left_2_f.wav';[y,fs] = audioread(file1);L=length(y);t=(1000*(0:1/fs:(L-1)/fs))';n = 2^nextpow2(L);Y=fft(y,n);P = abs(Y/n);P = P(1:n/2+1);P(2:end-1) = 2*P(2:end-1);power = abs(Y).^2/n; % power of the DFT
power = power(1:n/2+1);power(2:end-1) = 2*power(2:end-1);f = fs*(0:(n/2))/n;f1 = fs*(0:n-1)/n;figuresubplot(4,1,1)plot(t,y)xlabel('Time in mseconds');ylabel('Audio Level');title('Plot of female voice ');grid ongrid minorsubplot(4,1,2)plot(f,P) title('Single-Sided Magnitude Spectrum of female voice ')xlabel('f (Hz)')ylabel('Magnitude')grid ongrid minorsubplot(4,1,3)[pk,j] = findpeaks(P,'SortStr','descend','NPeaks',8);Peaks(:,j) = f(j);xx=(f(:,j));xx=(sort(xx));[~,loc] = max(P);plot(f(1:10*loc),P(1:10*loc),f(j),pk,'o') title(['The maixmum of Magnitude Spectrum occurs at ( ' ,num2str(xx) , ' ) Hz' ])xlabel('f (Hz)')ylabel('Magnitude')grid ongrid minorsubplot(4,1,4)plot(f,power)xlabel('Frequency')ylabel('Power')
MATLAB: Hi , I make spectral analysis for female voice ( wav file for 2 word only ) , I get frequency contents below 1000 Hz , so is this correct , also I suspect computation of power of abs(fft) , please advise , thanks
power spectralspectral analysis for female voice
Best Answer