I2S to SD card #387
-
Hi, has anyone managed to record audio to a SD card from an I2S input? If there's an example that would be great. Currently I am using the I2S to I2S example where essentially the mic is in monitor mode. I now hope to save that data as a .wav. I see there was some discussed previously but unable to get anything working myself. I am using an ESP32-S3-WROOM-1 Here is the example that is working: uint16_t sample_rate=44100; // Arduino Setup Serial.begin(115200); // start I2S in Serial.println("I2S started..."); // Arduino loop - copy sound to out |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I suggest that you decide first on what SD card API you want to use and learn how to use files: You can use SD, SDMMC or SDFAT. Only after you know that your files are working move to the next step! I suggest that you have a look at the following example which creates and then plays a file using the SD library: https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/streams-audiokit-sd-audiokit/streams-audiokit-sd-audiokit.ino. It uses the AudioKitStream as input and output, so you can just replace it with an I2SStream ... How to create a wav file is explained here: https://github.com/pschatzmann/arduino-audio-tools/wiki/Encoding-and-Decoding-of-Audio. You just wrap the file in a EncodedAudioStream with an encoder! |
Beta Was this translation helpful? Give feedback.
I suggest that you decide first on what SD card API you want to use and learn how to use files: You can use SD, SDMMC or SDFAT.
A file is just a stream, so it can be used as copy destination by using StreamCopy. At the end don't forget to close the file - otherwise you will not have any data!
Only after you know that your files are working move to the next step!
I suggest that you have a look at the following example which creates and then plays a file using the SD library: https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/streams-audiokit-sd-audiokit/streams-audiokit-sd-audiokit.ino. It uses the AudioKitStream as input and output, so you can just rep…