What do you want to do
"Connect the 8ch digital microphone to the Sony Spresense and
Audio library records high-resolution band (at least 20 kHz) sound with 192 kHz sampling and
Save to SD Card as a wav format file
As a step 1 to achieve the above, the following are successful.
"Connect one analog microphone to the Sony Spresense and
Record audible sound (below 20 kHz) with 48 kHz sampling and
Save to SD Card as mp3 Format File
As per the instructions in the Spresense Arduino Library development guide, we install the DSP Codec binary, obtain a sketch sample, and only change the location where the DSP files are installed.
Here are the sketch samples I got.
https://github.com/sonydevworld/spresense-arduino-compatible/tree/master/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder
The next step 2 will not work for what you want to achieve.
"Connect one analog microphone to the Sony Spresense and
Record audible sound (below 20 kHz) with 48 kHz sampling and
Save to SD Card as a wav format file
Recording ends without an error code and the wav file is created, but it cannot be played.
Below is the error message when playing in Windows Media Player.
US>"The file cannot be played.The player does not support the file type or
It may not support the codec used to compress the file."
The code here is
from the above sketch sample.
Changing codec type settings for playback content.
The changed code line is as follows:
theAudio->setRecorderMode(AS_SETRECDR_STS_INPUTDEVICE_MIC_A);
theAudio->initRecorder(AS_CODECTYPE_PCM, "/mnt/spif/BIN", AS_SAMPLINGRATE_48000, AS_CHANNEL_MONO);
puts("Init Recorder!");
myFile=theSD.open("test.wav", FILE_WRITE);
Question
I would like more information such as the source code of the program after the change, the wavefile file size, and hexdump of the header.
Did you close the file properly? Otherwise, the file may be corrupted.
It may not have been answered, but I think it would be better to use the Spresense SDK as it seems that the spresense is not motivated to develop Arduino.
© 2024 OneMinuteCode. All rights reserved.