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

1 次查看(过去 30 天)
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')

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Measurements and Spatial Audio 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by