Real time application of biquad filter to xmos mic data

If you have a simple question and just want an answer.
Post Reply
shaileshwankhede
Experienced Member
Posts: 65
Joined: Fri Dec 02, 2016 1:30 pm

Real time application of biquad filter to xmos mic data

Post by shaileshwankhede »

Hello,

I am using xCORE Array Microphone for record and play (end application - Telephony). As a next step I am trying to filter out office AC noise after checking noise profile. I have designed IIR filter of order 6 using MATLAB and got filter coeficients (attached frequency response curve for same). Now I want to apply this filter on real mic data.
I am using app_usb_aud_mic_array as reference code and user_pdm_process() is user hook where I thought of applying filter to incoming data. But with unsafe void user_pdm_process(mic_array_frame_time_domain * unsafe audio, int output[]) I can see that incoming frame is just one byte instead of array. So I have implemented circular buffer so that filter can be applied once particular amount of data is available and code of circular buffer without any filtering is working perfectly.
Every time I am processing BUFFER_SIZE/2 data with filter using dsp_filters_biquads method. But when I am recording, it's producing very much broken sound with beep-beep-beep. I think problem is dsp_filters_biquads is taking lot of time for these many samples so output rate is dropping lot. I even tried using lower buffer size then recorded sound is whistle like. I tried of using fast biquad filter given at: http://www.xcore.com/node/1192/revisions/1661/view but couldn't understand how to use it.
How can I achieve real time filtering? Or is there anything wrong the way I am calling filter method? Attached pdm_user file for reference.

Thanks,
Shailesh


User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Post by larry »

If your buffer size is a power of 2, you'd be best off configuring lib_mic_array to output that many audio frames at a time. To do that, set MIC_ARRAY_MAX_FRAME_SIZE_LOG2 in mic_array_conf.h to the appropriate power and data in your mic_array_frame_time_domain will contain that many samples times number of microphones.
Post Reply