Experiencing clicking noise with i2S-i2S example #931
-
I have two ESP32 connected with I2S. One is generating sinewave like this example. My actual code: #include "AudioTools.h"
#include "config.hpp"
AudioInfo info(16000, 1, 16);
SineWaveGenerator<int16_t> sineWave(32000);
GeneratedSoundStream<int16_t> sound(sineWave);
I2SStream out;
StreamCopy copier(out, sound);
void setup(void) {
Serial.begin(115200);
while(!Serial);
AudioLogger::instance().begin(Serial, AudioLogger::Warning);
auto config = out.defaultConfig(TX_MODE);
config.copyFrom(info);
config.port_no = I2S_NUM_1;
config.i2s_format = I2S_STD_FORMAT;
config.pin_ws = LISTENER_I2S_INNER_LRC;
config.pin_bck = LISTENER_I2S_INNER_BCLK;
config.pin_data = LISTENER_I2S_INNER_LDATA;
out.begin(config);
sineWave.begin(info, N_B4);
}
void loop() {
copier.copy();
} And the other is receiving sound and send it to DAC through I2S like this example. My actual code: #include "AudioTools.h"
#include "config.hpp"
AudioInfo info(16000, 1, 16);
I2SStream in;
I2SStream out;
StreamCopy copier(out, in);
void setup(void) {
Serial.begin(115200);
AudioLogger::instance().begin(Serial, AudioLogger::Warning);
auto config_in = in.defaultConfig(RX_MODE);
config_in.copyFrom(info);
config_in.i2s_format = I2S_STD_FORMAT;
config_in.is_master = true;
config_in.port_no = I2S_NUM_0;
config_in.pin_bck = SPEAKER_I2S_INNER_BCLK;
config_in.pin_ws = SPEAKER_I2S_INNER_LRC;
config_in.pin_data = SPEAKER_I2S_INNER_LDATA;
in.begin(config_in);
auto config_out = out.defaultConfig(TX_MODE);
config_out.copyFrom(info);
config_out.i2s_format = I2S_STD_FORMAT;
config_out.is_master = true;
config_out.port_no = I2S_NUM_1;
config_out.pin_bck = SPEAKER_I2S_OUTER_BCLK;
config_out.pin_ws = SPEAKER_I2S_OUTER_LRC;
config_out.pin_data = SPEAKER_I2S_OUTER_SDATA;
out.begin(config_out);
}
void loop() {
copier.copy();
} And now I got strange noise, and varying sound. Here's recorded audio with my iPhone: Notes:
![]() |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
After some search, I feel like this is related to Can anyone shed any light on this? |
Beta Was this translation helpful? Give feedback.
-
Update: when I set audio2.mp4 |
Beta Was this translation helpful? Give feedback.
-
Connecting 2 different ESP32 might not work because of the difference in the clock speeds, but using an I2S connection on the same ESP32 might work. Did you try to set config_in.use_apll and config_out.use_apll both to the same value ? true or false |
Beta Was this translation helpful? Give feedback.
Connecting 2 different ESP32 might not work because of the difference in the clock speeds, but using an I2S connection on the same ESP32 might work. Did you try to set config_in.use_apll and config_out.use_apll both to the same value ? true or false