I have to extract a particular frequency range from an audio signal. For that I am using an FIR filter of order 50 and it is written in MATLAB as below:
[input fs nbits]=wavread('female_speech.wav');
input=input(:,1)';
len=length(input);
order=50;
b1=fir1(order,[0.1 0.2]);
input_buffer=zeros(1,len);%%variable used to store incoming input samples
filter_input=zeros(1,order+1);%%input to the BPF which is equal to the order of BPF
for iteration=1:len
input_buffer(1,1)=input(1,iteration);
filter_input=input_buffer(1,1:order+1);
channel1_op(1,iteration)= b1*filter_input';
input_buffer=circshift(input_buffer',1)'
end
Here I am giving a .wav file as input and it is stored as an array and the processing in done for the entire samples. But if I want to implement in real time in MATLAB, i.e to input audio from the microphone connected to PC and then process that data in real time, what all things have to be considered regarding the coding since in real time the length of the data is not known before