I am providing a Bluetooth A2DP audio library for the ESP32, which can receive audio from a Bluetooth Source (e.g. a mobile phone) and play it via the I2S API provided by the IDF framework.

Unfortunately Espressif has decided to go for a completely new I2S API which means that my integration needs to be rewritten.

For quite some time now, I am supporting this new API via my AudioTools library, and I was considering to remove the I2S output functiontlity completely from my A2DP library and just use it a data provider for the AudioTools.

My latest design however looks as follows:

  • I am providing a separate output API in the A2DP library with the following class implementations:
  • If you use a Arduino ESP32 core version < 3.0.0 the legacy functionality continues to work
  • Starting from now, you can use the new API independently on the ESP32 core version.

I have updated the documentation and examples to use the new API.

I recommend to use the new API because this way you can be sure that your sketch will work in future ESP32 cores versions.

Example Sketch with the new API

#include "AudioTools.h
#include "BluetoothA2DPSink.h"

I2SStream i2s;
BluetoothA2DPSink a2dp_sink(i2s);

void setup() {
    auto cfg = i2s.defaultConfig();
    cfg.pin_bck = 14;
    cfg.pin_ws = 15;
    cfg.pin_data = 22;
    i2s.begin(cfg);

    a2dp_sink.start("MyMusic");
}

void loop() {
}

This comes at the cost, that you also need to install the AudioTools library now!


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *