snapshot
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
|
||||
# Stream I2S Input to CSV Output
|
||||
|
||||
## General Description:
|
||||
|
||||
We implement a I2S source: We stream the sound input which we read in from the I2S interface and displays it on the Arduino Serial Plotter.
|
||||
|
||||
We can use any device which provides the sound data via I2S. In this case it is a 'I2S ADC Audio I2S Capture Card Module'
|
||||
Usually you do not need any master clock, but unfortunatly we need to feed this module with a master clock signal from the ESP32, if
|
||||
the ESP32 is acting as master.
|
||||
|
||||
## Pins
|
||||
|
||||

|
||||
|
||||
|
||||
| i2s-ADC | ESP32
|
||||
| ---------| ---------------
|
||||
| MCCLK_IN | RX_0 (GPIO3)
|
||||
| BICK | BCK (GPIO14)
|
||||
| DATA | IN (GPIO32)
|
||||
| RLCLK | WS (GPIO15)
|
||||
| GND | GND
|
||||
| MUTE | -
|
||||
| VCC | VIN 5V
|
||||
|
||||
|
||||
## Additional Comments
|
||||
|
||||
I recommend this sketch as a starting point for all I2S input. Just leave the masterclock out, because this is not needed for most input devices.
|
||||
If it is working with 32 bit you can try to change it to 16bits which most of the time works as well:
|
||||
|
||||
- CsvOutput<int16_t> csvOutput(Serial);
|
||||
- cfg.bits_per_sample = 16;
|
||||
|
||||
see streams-12s-serial_16_bit
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @file streams-i2s-serial.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-stream/streams-i2s-serial/README.md
|
||||
*
|
||||
* @author Phil Schatzmann
|
||||
* @copyright GPLv3
|
||||
*/
|
||||
|
||||
|
||||
#include "AudioTools.h"
|
||||
|
||||
AudioInfo info(44100, 2, 32);
|
||||
I2SStream i2sStream; // Access I2S as stream
|
||||
CsvOutput<int32_t> csvOutput(Serial);
|
||||
StreamCopy copier(csvOutput, i2sStream); // copy i2sStream to csvOutput
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
auto cfg = i2sStream.defaultConfig(RX_MODE);
|
||||
cfg.copyFrom(info);
|
||||
cfg.i2s_format = I2S_STD_FORMAT; // or try with I2S_LSB_FORMAT
|
||||
cfg.is_master = true;
|
||||
// this module nees a master clock if the ESP32 is master
|
||||
cfg.use_apll = false; // try with yes
|
||||
cfg.pin_mck = 3;
|
||||
i2sStream.begin(cfg);
|
||||
|
||||
// make sure that we have the correct channels set up
|
||||
csvOutput.begin(info);
|
||||
|
||||
}
|
||||
|
||||
// Arduino loop - copy data
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
Reference in New Issue
Block a user