how to get max frequency and how to get frequency response for 0.5 seconds wav file by using following code?

1 view (last 30 days)
this is the code in which I need frequency response for 0.5 seconds and how to set xlim and max frequency ?
[y,fs]=audioread('filename.wav);
Nsamps = length(y);
t = (1/fs)*(1:Nsamps)
% do fourier transformer
y_fft= abs(fft(y));
y_fft= y_fft(1:Nsamps/2);
f=fs*(0:Nsamps/2-1)/Nsamps;
%plot sound file in Time domain
figure
plot (t, y)
xlabel('Time (S)')
ylabel ('amplitude')
title('file name in Time Domain')
%plot sound file in frequency domain
plot(f, y_fft)
xlim([0 1000])
xlabel('frequency(HZ)')
ylabel('amplitude')
title('frequency response of song')

Answers (0)

Categories

Find more on Measurements and Spatial Audio in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!