Upcoming maintenance
Dear Customers and Partners.
This website will be undergoing scheduled maintenance on June 14, 2023. Please be aware there may be disruption to the developer portal website and associated services during the scheduled maintenance period.
This upgrade is essential to ensure the continued performance, reliability, and security of Developer World.
We apologize for any inconvenience.
Audio Recorder Example not working under 8000 and 16000 sample rate
-
I connect 4 analog mics to the board and the audio recorder example is running successfully when the sampling rate is 48000. However, if I lower the sampling rate to 8000 or 16000, there is an error when running. It shows (print out) set_recording_mode() failure. Please kindly suggest how can I modify the code to make it work under a low sampling rate. Thanks in advance for any help!
-
@LarryThe above issues occur when I tried the 8k sample rate. When I use the 16K sample rate, it has the following errors (While this sample rate should work based on the instruction of the sample code, I am not sure whether this is a bug or not):
-
Hi @Larry,
I have a question. Have you completed this step:
Link to documentation: https://developer.sony.com/develop/spresense/docs/sdk_tutorials_en.html#_build_flash_3
Best Regards,
Kamil Tomaszewski -
@KamilTomaszewski Hi Kamil, Thank you for your kind reply. I do not think my issue is related to the SD card configuration. I can run the sample code successfully under the 48k and 192k (while somehow the recording time becomes 3.3s for the 192k sample rate, which is also strange) sample rate. If I change the sample rate to 8K and 16K, it has the mentioned errors. Would you please suggest how can I modify the code to make it work under the 8k sample rate? Thank you in advance for any help!
-
Hi @Larry,
48kHz and 192kHz are the native sampling rates. For this reason you don't need to use DSP binary as the sampling rate converter is not needed. However, if you want to use other sampling rates such as 8kHz or 16kHz then you need to put the DSP binary on the SD card or flash memory.
Best Regards,
Kamil Tomaszewski -
@KamilTomaszewski Thanks for your reply. I checked my SD card and I put both 'MP3DEC' and 'WAVDEC' under the BIN folder of the SD card. I still think the SD card configuration is not the issue. If the sample code can support 8k sample rate, I think it should be fully listed here (in the comment part, rather than 3 sample rate listed right now)
If possible, would you please confirm on your side by simply modifying the main file of this example to: Set sampling_rate to 8000, Set channel_number to AS_CHANNEL_4CH? Please let me know if such modification can run without any errors on your side.
Thanks in advance for any help.
Best,
Larry
-
Hi @Larry,
I've checked. Only 16kHz, 48kHz and 192kHz are supported for recording.
Best Regards,
Kamil Tomaszewski -
@KamilTomaszewski Hi Kamil, is it possible to change the example code to make it works under 8k sample rate? I set it to 4 channels and it is even not working when using the 16k sample rate. Thanks in advance for any help.
-
Hi @Larry,
What happens when you try to use 16kHz and 4 channels?
I will try to see if it is possible to change something to use 8kHz.
Best Regards,
Kamil Tomaszewski -
@KamilTomaszewski Thank you so much for your kind reply.
- The error when using 16k sample rate, 4 channels, and 100 default_mic_gain is shown below
- The error when using 192k sample rate, 4 channels, and 100 default_mic_gain is shown below
3) I sincerely hope to get your feedback/suggestions on how to modify this example to make it work under 8k sample rate with 4 channels and 100 default_mic_gain.
Best,
Larry
- The error when using 16k sample rate, 4 channels, and 100 default_mic_gain is shown below
-
Hi @Larry,
-
For 16kHz, it is necessary to load the DSP binary for encoding. Do you have such a file: "/mnt/sd0/BIN/SRC" on your SD card?
-
You get this error because the fifo is overflowing: https://github.com/sonydevworld/spresense/blob/959182b937dccde216fcb8289de0ac9de3367880/sdk/modules/audio/objects/media_recorder/audio_recorder_sink.cpp#L84
You get a lot of data and you don't read it quickly enough. For example, a slow SD card may be a problem.
Best Regards,
Kamil Tomaszewski -
-
@KamilTomaszewski Hi Kamil, I feel grateful for your kind reply.
- for the 16k sample rate not working issue, right now my SD card has the following folder when using the SD card reader on PC:
When you mentioned "Do you have such a file: "/mnt/sd0/BIN/SRC" on your SD card?", do you mean that I should put both MP3ENC and SRC under the BIN folder?
I need further clarification on this. - Would you please share with me the link of the SD card (or the exact type of SD card) you use for solving the slow reading rate issue?
I am looking forward to your reply. Thanks in advance for any help!
Best,
Larry
- for the 16k sample rate not working issue, right now my SD card has the following folder when using the SD card reader on PC:
-
@KamilTomaszewski Hi Kamil, I find out that the 16k sample rate not working is indeed my fault. The DSP binary is not correctly put in the SD card. And the example code can also be simply modified to support the 8000 sample rate (A small issue is that the recording time becomes 9.8s, not exactly 10s) Thank you for your kind reminder.
- Would you please provide some hints on how can I modify this example to use it for timely calculating the SNR (Signal power to Noise power ratio)?
Thank you in advance for any help.
Best,
Larry
-
-