Band Pass Filter from audiorecord

3 views (last 30 days)
hi, im trying to filter an audio using a bandpass filter for 400-2000Hz, im getting the audio from audiorecord and then plotting it with getaudiodata but when i tried to add the getaudiodata to my filter, just doesnt work. so far this is what i have:
clc;
fs = 8000;
a = audiorecorder (fs, 8, 1);
t = 0:1/fs:5;
disp('start speaking')
recordblocking(a, 5);
disp('stop speaking');
b = getaudiodata(a);
play(a);
x = fft(b);
subplot(2,1,1);
plot (x)
title('Señal de Audio original(spectrum)');
subplot(2,1,2);
plot(b); %señal original
title('Señal de Audio original');
After this how do i apply a filter to b = getaudiodata(a);

Answers (1)

Star Strider
Star Strider on 30 Jul 2020
Use the bandpass function (R2018a and later). It is best to use this with the known sampling frequency (so using audioread rather than audioninfo), however you might be able to get it to work using a sampling frequency of 1 with audioinfo.
  2 Comments
miroslava del carmen villanueva castillo
i did this:
clc;
fs = 8000;
a = audiorecorder (fs, 8, 1);
disp('empieza grabacion')
recordblocking(a, 3);
disp('fin de grabacion');
b = getaudiodata(a);
k=bandpass(b,[400 2000],8000);
subplot(2,2,1);
plot(k)
x = fft(b);
subplot(2,1,1);
plot (x) %fft de señal de audio original
title('Señal de Audio original(espectro)');
subplot(2,1,2);
plot(b); %señal original
title('Señal de Audio original');
play(a);
and doesnt show any error but i dont get the graph for the bandpass, what could it be?
Star Strider
Star Strider on 30 Jul 2020
You need to use audioread and use the sampling frequency (second output) with bandpass to get the result you want.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!