Hi all, I'm trying to use the esp as wifi-bt audio-bridge. the goal is to stream/send an audio file to the esp via wifi and then use the esp to play that file on a bt headset. Starting from the a2dp_source example sketch I've succesfully connected the headset and played the random audio. Then with the code below (from
https://github.com/nopnop2002/esp-idf-a2dp-source) I've played the music byte array. Now I'm stuck on the best way to achieve the last step: send/stream the audio from a network source. I've seen the esp-webradio (
https://github.com/MrBuddyCasino/ESP32_MP3_Decoder) but haven't found how to achieve a similiar result. The device I've choosen doesn't have sd card (a wearable) so the only way is to send/stream the audio files. Any Idea on how to do that? Thanks
Code: Select all
static int32_t bt_app_a2d_data_cb(uint8_t *data, int32_t len)
{
//nop
static int32_t music_pointer = 0;
if (len < 0 || data == NULL) {
return 0;
}
for (int i = 0; i < (len >> 1); i++) {
// decrease volume
uint16_t val = music[music_pointer] * 0.5;
// convert to bytes
data[(i << 1) ] = val & 0xff;
data[(i << 1) + 1] = (val >> 8) & 0xff;
// loop through music
music_pointer = (music_pointer +1) % MUSIC_LEN;
}
return len;
}