I changed my test-setup to a teensy 4.1 and soldered a test-PCB for better testing, because in the audio design GUI its noted that
"On Teensy 3.x, the BCLK/LRCLK ratio is 32, which is not compatible with most MEMS microphones. Teensy 4.x uses BCLK/LRCLK ratio, which can be used with I2S MEMS microphones."
I also change both the code of the ESP and teensy.
ESP:
Code:
#include <arduino.h>
#include "esp32_bt_music_receiver.h"
BlootoothA2DSink a2d_sink;
void setup() {
static const i2s_config_t i2s_config = {
.mode = (i2s_mode_t) (I2S_MODE_SLAVE | I2S_MODE_TX),
.sample_rate = 44100,
.bits_per_sample = (i2s_bits_per_sample_t)32,
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
.communication_format = (i2s_comm_format_t) (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB),
.intr_alloc_flags = 0, // default interrupt priority
.dma_buf_count = 8,
.dma_buf_len = 64,
.use_apll = false
};
a2d_sink.set_i2s_config(i2s_config);
a2d_sink.start("MyMusic");
Serial.begin(115200);
}
unsigned long last = 0;
void loop() {
if ((millis() - last) > 100) {
last = millis();
Serial.println(a2d_sink.get_audio_state());
//Serial.println(a2d_sink.get_audio_type());
}
}
Teensy:
Code:
#include <Audio.h>
#include <Wire.h>
AudioInputI2SQuad i2s_quad1; //xy=172.00000381469727,224.00000762939453
AudioAnalyzeFFT1024 fft1024_1; //xy=327.00000762939453,369.0000114440918
AudioAnalyzePeak peak2; //xy=331.0000114440918,333.00000953674316
AudioAnalyzePeak peak1; //xy=333.00000762939453,292.00000858306885
AudioOutputI2S i2s1; //xy=383,217
AudioConnection patchCord1(i2s_quad1, 2, i2s1, 0);
AudioConnection patchCord2(i2s_quad1, 2, peak1, 0);
AudioConnection patchCord3(i2s_quad1, 2, fft1024_1, 0);
AudioConnection patchCord4(i2s_quad1, 3, i2s1, 1);
AudioConnection patchCord5(i2s_quad1, 3, peak2, 0);
AudioControlSGTL5000 sgtl5000_1; //xy=302,184
void setup() {
AudioMemory(20);
sgtl5000_1.enable();
sgtl5000_1.volume(0.7);
Serial.begin(115200);
}
elapsedMillis a = 0;
void loop() {
if(a >= 10 and peak1.available()){
a = 0;
Serial.println(peak1.read(), 20);
}
}
To make things easier.
By reading the Peakof the incomming audio signal its clear that the audio is wrong interpreted by the teensy, because there also is this noise:

So changing
Code:
.communication_format = (i2s_comm_format_t) (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB),
to
Code:
.communication_format = (i2s_comm_format_t) (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_LSB),
on the ESP's side, might point to something like that, because then the teensy receives no audio at all.