sample rate changes #617
-
I've set up a basic a2dp sink on an lolin d32 pro with an adafruit max 98357a. When I first connect with my laptop (Ubuntu 24.04, 48k sample rate), disconnect, and connect with my Pixel 6a (sample rate 44,1K), the test sine of 440hz is being played slightly higher - and vice versa: test tone from my laptop is too low after first connecting with my phone. I guess this means that the i2s sample rate is not really being updated? Or I am missing something? I've read through the issues en discussions here and on the audiotools github, but didn't found anything that could help me out. Latest versions of esp32 core, esp32-a2dp en audiotools libs.
|
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 21 replies
-
This is the first time I see another sample rate then 44100. I just committed a correction which should resolve this. |
Beta Was this translation helpful? Give feedback.
-
Thanks @pschatzmann for the swift response. I've pulled from master, but still the same however. If I'm not mistaken, sample rate has been changed to 48k since the switch to pipewire
|
Beta Was this translation helpful? Give feedback.
-
I am still confused how this can happen. Do you see the following entry in the log BluetoothA2DPOutput.cpp:217 end()) 15:52:21.917 -> [ 54275][I][BluetoothA2DPOutput.cpp:229] set_sample_rate(): [BT_AV] set_sample_rate 44100 |
Beta Was this translation helpful? Give feedback.
-
Maybe you can help me to trace this down: I am expecting that the following line in BluetoothAudioOutput.cpp line 237 |
Beta Was this translation helpful? Give feedback.
-
Can you try the following test case which is simulating the scenario and working for me #include "AudioTools.h"
I2SStream i2s;
AudioInfo info1(48000,2,16);
AudioInfo info2(44100,2,16);
void setup() {
Serial.begin(115200);
AudioLogger::instance().begin(Serial, AudioLogger::Info);
// start initial i2s
auto cfg = i2s.defaultConfig();
cfg.copyFrom(info1);
i2s.begin(cfg);
assert(i2s.audioInfo()==info1);
// stop it and set new rate
i2s.end();
Serial.println("--------------------");
i2s.setAudioInfo(info2);
assert(i2s.audioInfo()==info2);
// start it with new rate
i2s.begin();
assert(i2s.audioInfo()==info2);
Serial.println("success");
}
void loop() {
} |
Beta Was this translation helpful? Give feedback.
-
That's not how things work: you need to reasmple using the AudioTools! |
Beta Was this translation helpful? Give feedback.
-
You would just define the pin: on the ESP32 this is usually GPIO 0 |
Beta Was this translation helpful? Give feedback.
This is the first time I see another sample rate then 44100.
I just committed a correction which should resolve this.