audio wave filter out bandpass 900-1kHz

2 次查看(过去 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?

回答(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! :)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Audio Processing Algorithm Design 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by