I would like to retrieve audio data from the microphone by referring to the example sketch pcm_capture in Spresense-Arduino and send the data via Wifi.
Sketch example: I understand that the following code in pcm_capture shows the contents of the captured audio data, but I don't know exactly what kind of structure the audio data is stored in.
printf("Size%d[%02x%02x%02x%02x%02x%02x...]\n",
size,
s_buffer[0],
s_buffer[1],
s_buffer[2],
s_buffer[3],
s_buffer[4],
s_buffer[5],
s_buffer[6],
s_buffer[7]);
What should I do if I want MIC_A audio data while recording with 4CH?
Thank you for your cooperation.
spresense arduino
I am in charge of SPRESENSE support for Sony.
I will answer your inquiry.
The PCM capture data is stored in the buffer as follows:
These data are easier to process when you define a structure and cast the contents of the buffer.
Provides a brief sample code for 16-bit and 24-bit audio.
■ for 16-bit 4Ch recordings
structure channel_bit16 { uint16_tmicA; uint16_tmicB; uint16_tmicC; uint16_tmicD; }; struct channel_bit16*mic_data=(struct channel_bit16*)s_buffer;// Access 0th data uint16_tmic_a =mic_data[0].micA; uint16_tmic_b =mic_data[0].micB; uint16_tmic_c =mic_data[0].micC; uint16_tmic_d =mic_data[0].micD;
■ For 24-bit 4Ch recordings
structure channel_bit24 { uint32_tmicA; uint32_tmicB; uint32_tmicC; uint32_tmicD; }; struct channel_bit24*mic_data=(struct channel_bit24*)s_buffer;// Access 0th data uint32_tmic_a =mic_data[0].micA; uint32_tmic_b =mic_data[0].micB; uint32_tmic_c =mic_data[0].micC; uint32_tmic_d =mic_data[0].micD;
I hope that you will be able to you.
Thank you for your continued support at SPRESENSE.
SPRESENSE Support Team
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.