snapshot
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
|
||||
# Stream Analog Input to I2S
|
||||
|
||||
## General Description:
|
||||
|
||||
In this sketch we get the data from via the ESP32 I2S ADC and send it to I2S
|
||||
Since the ADC via I2S is using the i2s port 0, we use port 1 for the output.
|
||||
|
||||
### Analog Input:
|
||||
|
||||
| ADC | ESP32
|
||||
| --------| ---------------
|
||||
| VCC | 3.3V
|
||||
| GND | GND
|
||||
| OUT | GPIO34
|
||||
|
||||
For the input I was using a MCP6022 Microphone Sensor.
|
||||
Plaese note that the signal that we receive from the ADC needs to be adjusted so that it is oscillating around 0.
|
||||
|
||||

|
||||
|
||||
|
||||
### External DAC:
|
||||
|
||||
|
||||
For my tests I am using the 24-bit PCM5102 PCM5102A Stereo DAC Digital-to-analog Converter PLL Voice Module pHAT
|
||||
|
||||
I am just using the default pins defined by the framework. However I could change them with the help of the config object. The mute pin can be defined in the constructor of the I2SStream - by not defining anything we use the default which is GPIO23
|
||||
|
||||
DAC | ESP32
|
||||
-----|----------------
|
||||
VCC | 5V
|
||||
GND | GND
|
||||
BCK | BCK (GPIO14)
|
||||
DIN | OUT (GPIO22)
|
||||
LCK | WS (GPIO15)
|
||||
FMT | GND
|
||||
XMT | 3V (or another GPIO PIN which is set to high)
|
||||
|
||||
- DMP - De-emphasis control for 44.1kHz sampling rate(1): Off (Low) / On (High)
|
||||
- FLT - Filter select : Normal latency (Low) / Low latency (High)
|
||||
- SCL - System clock input (probably SCL on your board).
|
||||
- FMT - Audio format selection : I2S (Low) / Left justified (High)
|
||||
- XMT - Soft mute control(1): Soft mute (Low) / soft un-mute (High)
|
||||
|
||||

|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @file streams-analog-i2s.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-stream/streams-adc-i2s/README.md
|
||||
*
|
||||
* @author Phil Schatzmann
|
||||
* @copyright GPLv3
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
|
||||
AudioInfo info(44100, 2, 16);
|
||||
AnalogAudioStream in;
|
||||
I2SStream out;
|
||||
StreamCopy copier(out, in); // copy in to out
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// RX automatically uses port 0 with pin GPIO34
|
||||
auto cfgRx = in.defaultConfig(RX_MODE);
|
||||
cfgRx.copyFrom(info);
|
||||
in.begin(cfgRx);
|
||||
|
||||
// TX on I2S_NUM_1
|
||||
auto cfgTx = out.defaultConfig(TX_MODE);
|
||||
cfgTx.port_no = 1;
|
||||
cfgTx.copyFrom(info);
|
||||
out.begin(cfgTx);
|
||||
}
|
||||
|
||||
// Arduino loop - copy data
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
Reference in New Issue
Block a user