Skip to content

Save audio from I2S mic to .wav file on SD card #440

Discussion options

You must be logged in to vote

Thanks for the input!
I tried to implement the changes you proposed, however, I still can't seem to get it to write anything in the file that is being created...

This is the updated sketch:

#include <TFT_eSPI.h>
#include <SPI.h>
#include "Arduino.h"
#include "AudioTools.h"
#include "SD.h"

#define SD_CS     5
#define SD_MOSI   33
#define SD_MISO   1
#define SD_SCK    9



SPIClass SPISD(HSPI); // Creates SPI object using the HSPI interface

bool recording = false;
unsigned long runtime;


I2SStream i2s; // Access I2S as a stream

File audioFile; //empty audio file object
EncodedAudioStream out(&audioFile, new WAVEncoder()); // Access audioFile as a stream

StreamCopy copier(out, i2s); // …

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@pschatzmann
Comment options

@rasmushauschild
Comment options

@ksaye
Comment options

Answer selected by pschatzmann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants