audio wave filter out bandpass 900-1kHz
3 ビュー (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
回答 (1 件)
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
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! :)
参考
カテゴリ
Help Center および File Exchange で Audio I/O and Waveform Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!