フィルターのクリア

how to change this code to plot the frequency response of the desired interval?

1 回表示 (過去 30 日間)
Hi! I am using the R2021b Matlab and I need this code to plot the frequency response of the audio in the specified time interval. Could anyone help me please?
The code is displayed below:
recObj = audiorecorder;
Fs=8000;
filename = sprintf('myAudioData.wav');
disp('Start speaking.')
recordblocking(recObj, 10);
disp('End of Recording.');
doubleArray = getaudiodata(recObj);
audiowrite(filename,doubleArray,Fs);
[x,Fs] = audioread('myAudioData.wav');
ts = 1 / Fs;
n = round(0.02 / ts);
nexttile
t1 = 1.000;
t2 = 1.020;
% start and end index in audio data of segment of interest
idx1 = round(t1/ts);
idx2 = round(t2/ts);
% plot it!
plot(x(idx1:idx2)); % plot 1st 20 ms of audio file
nexttile
t3 = 3.000;
t4 = 3.020;
% start and end index in audio data of segment of interest
idx3 = round(t3/ts);
idx4 = round(t4/ts);
% plot it!
plot(x(idx3:idx4));

採用された回答

Star Strider
Star Strider 2022 年 3 月 23 日
That depends on what you want as the result.
Two possibilities are fft and pspectrum with the 'spectrogram' option.
  7 件のコメント
Michael Sugiarto
Michael Sugiarto 2022 年 3 月 23 日
Thankyou so much I will try it now!!
Star Strider
Star Strider 2022 年 3 月 23 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMeasurements and Spatial Audio についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by