ESP32 Bluetooth A2DP-SOURCE for esp-idf.
Play wav to speaker via bluetooth.
ESP-IDF contains A2DP-SOURCE demo code.
https://github.com/espressif/esp-idf/tree/master/examples/bluetooth/bluedroid/classic_bt/a2dp_source
However, this example sends random noise data, not music.
This project sends WAV(RIFF waveform Audio Format) data using A2DP.
You can listen WAV data using your bluetooth speaker.
I used this as a reference.
- You can specify your speaker name using menuconfig.
- WAV data is defined as hexadecimal data.
This reduces the size of the header file. - A header file generator is attached.
- Bluetooth speaker
git clone https://github.com/nopnop2002/esp-idf-a2dp-source
cd esp-idf-a2dp-source
make menuconfig
make flash monitor
You have to set this config value with menuconfig.
- CONFIG_SPEAKER_NAME
Your bluetooth speaker name.
You can use this application to find the name of your Bluetooth speaker.
It is necessary to read the WAV file at high speed.
If you put the WAV file in SPIFFS and read it, it will not be in time.
It can be read at high speed by converting it to the C language header format.
I made this program with reference to this site.
cd wav2code
make
./wav2code futta-prayer3t.wav music.h
cp music.h ../main/
cd ..
make flash monitor
I downloaded the WAV file from here.
There is many WAV format data in the Internet.
The WAV file header has an average number of bytes per second.
This determines the speed at which it plays.
This project ignores this.