audio wave filter out bandpass 900-1kHz

3 ビュー (過去 30 日間)
ting po chun
ting po chun 2023 年 6 月 23 日
コメント済み: ting po chun 2023 年 6 月 23 日
Hi;
I want to filter the recorded audio file out of the 900-1kHz range and convert it into an impulse response. How can I do it?

回答 (1 件)

Deep
Deep 2023 年 6 月 23 日
You can read your audio file using the audioread function:
[y, Fs] = audioread('audiofile.wav');
More info: audioread
To filter out the 900-1kHz range, you can use a bandstop filter. MATLAB provides the designfilt function for this purpose:
d = designfilt('bandstopiir', 'FilterOrder', 2, ...
'HalfPowerFrequency1', 900, 'HalfPowerFrequency2', 1000, ...
'DesignMethod', 'butter', 'SampleRate', Fs);
filtered_audio = filtfilt(d, y);
More info:
Finally, you can convert the filtered audio into an impulse response using the inverse Fast Fourier Transform, provided by the ifft function:
impulse_response = ifft(filtered_audio);
More info: ifft
This impulse response might not be in a playable range, so you might want to normalize it:
impulse_response = impulse_response / max(abs(impulse_response));
Please explore the documentation links provided to understand more about the functions used.
  3 件のコメント
Deep
Deep 2023 年 6 月 23 日
Sure, plotting can be done by simply using the plot function.
% Define the sample rate. You can check this in your WAV file's properties.
Fs = 44100;
% Create a time vector
t = (0:length(impulse_response)-1)/Fs;
% Plot the impulse response
plot(t, impulse_response);
xlabel('Time (s)');
ylabel('Amplitude');
title('Impulse Response');
Hope this helps! :)
ting po chun
ting po chun 2023 年 6 月 23 日
Thank you so much again!

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

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by