Skip to content

Instantly share code, notes, and snippets.

@ffaerber
Last active May 31, 2024 08:07
Show Gist options
  • Save ffaerber/2414ac572fa0c68219aaa60fa533323e to your computer and use it in GitHub Desktop.
Save ffaerber/2414ac572fa0c68219aaa60fa533323e to your computer and use it in GitHub Desktop.
Usage of Seeed Studio XIAO ESP32S3 microphone with arduino-audio-tools
// Usage of Seeed Studio XIAO ESP32S3 microphone with github.com/pschatzmann/arduino-audio-tools
// https://wiki.seeedstudio.com/xiao_esp32s3_sense_mic/
#include "AudioTools.h"
AudioInfo info(16000, 1, 16);
I2SStream i2sStream; // Access I2S as stream
CsvOutput<int16_t> csvStream(Serial);
StreamCopy copier(csvStream, i2sStream); // copy i2sStream to csvStream
// Arduino Setup
void setup(void) {
Serial.begin(115200);
AudioLogger::instance().begin(Serial, AudioLogger::Info);
auto cfg = i2sStream.defaultConfig(RX_MODE);
cfg.copyFrom(info);
cfg.signal_type = PDM;
cfg.i2s_format = I2S_PCM;
cfg.pin_bck = I2S_PIN_NO_CHANGE;
cfg.pin_ws = 42;
cfg.pin_data = 41;
i2sStream.begin(cfg);
csvStream.begin(info);
}
// Arduino loop - copy data
void loop() {
copier.copy();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment