Borrar filtros
Borrar filtros

audio wave filter out bandpass 900-1kHz

2 visualizaciones (últimos 30 días)
ting po chun
ting po chun el 23 de Jun. de 2023
Comentada: ting po chun el 23 de Jun. de 2023
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?

Respuestas (1)

Deep
Deep el 23 de Jun. de 2023
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 comentarios
Deep
Deep el 23 de Jun. de 2023
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 el 23 de Jun. de 2023
Thank you so much again!

Iniciar sesión para comentar.

Categorías

Más información sobre Audio Processing Algorithm Design en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by