How to calculate mean of audio sample?? Topic is solved

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

How to calculate mean of audio sample??

Post by shaileshwankhede »

Hi,

I am trying to calculate mean of buffered mic channel data. i am using xCORE Array Microphone which has 7 mics and I am using circular buffer to buffer some data for postprocessing. When I am calling dsp_vector_mean function over this buffered data program seems to halt over there. When I try to debug its showing message:
Program stopped at 0x40000.
It stopped with signal SIGTRAP, Trace/breakpoint trap.
Type "info stack" or "info registers" for more information.
Current language: auto; currently minimal
mi_cmd_var_create: unable to create variable object
It means some exception is happening. I am able to calculate mean over predefined test vector but not getting what's wrong over here? Any hint or debug cases?

I am attaching my xc file here for reference.

Thanks,
Shailesh
Attachments
pdm_user.xc
(7.63 KiB) Downloaded 212 times
pdm_user.xc
(7.63 KiB) Downloaded 212 times


View Solution
shaileshwankhede
Experienced Member
Posts: 65
Joined: Fri Dec 02, 2016 1:30 pm

Post by shaileshwankhede »

I got the problem for exception. Maybe overflow was happening.
I changed value of q_format from 31 to 24 and now exception not appearing.
I want clarification on q_format of mic audio out data from pcm_pdm_mic of module_usb_audio.
Is it Q_24? I couldn't see any documentation for this. Correct me if I am wrong.

Thanks,
Shailesh
shaileshwankhede
Experienced Member
Posts: 65
Joined: Fri Dec 02, 2016 1:30 pm

Post by shaileshwankhede »

Actually it was division by zero exception because of truncation.
Post Reply