Simulink Raspberry pi ALSA audioCapture data type miss match

1 view (last 30 days)
Hi.
I'm trying to get 32bit audio data from the raspberry pi microphone array.
But i got this error:
For '?' of 'simulink_test/ALSA Audio Capture', the 'stepImpl' method of the System object 'codertarget.raspi.internal.RaspiALSAAudioCapture' returned a value that has data type 'int16'. This data type does not match the type 'int32' returned by the 'getOutputDataTypeImpl' method, inherited from System object 'codertarget.linux.blocks.ALSAAudioCapture'. To override the inherited behavior, customize 'getOutputDataTypeImpl' for System object 'codertarget.raspi.internal.RaspiALSAAudioCapture'.
With this microphone array, data can only be received in 32-bit, and my deep learning model was also trained with 32-bit data.
How can I fix this error?
Thank you.

Answers (1)

Brandon Stevens
Brandon Stevens on 10 Nov 2022
For the 'ALSA Audio Capture' block there is a block paramater called 'Device bit depth' that you would want to change to 32-bit.
This parameter specifies what data type the audio data should be cast to. The default is 16-bit which seems to be what your parameter is set to.
For more information, check out the documentation page for the block:
https://www.mathworks.com/help/supportpkg/raspberrypi/ref/alsaaudiocapture.html

Community Treasure Hunt

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

Start Hunting!