Page 1 of 1

Capture and Record A2DP Values

Posted: Mon Apr 01, 2019 1:44 pm
by Kerry.Ford
Hi all,

Presently, I am working on the early stages of a Bluetooth audio project. To get started, I looked through and flashed the code for the a2dp_sink example for the ESP32 (I am using the ESP32 WROOM).

My goal, at this stage, is to capture and record the incoming Bluetooth audio bytes and store them in a text file which can be accessed by a separate program which will plot a graph based on each digital value of the received audio. After looking through the code, I determined (possibly incorrectly) that the bt_app_a2d_data_cb function in the bt_app_av class would be the correct location to capture my desired data (prior to being written to I2S).

However, the 'data' variable at this location seems to hold an array of the data (unless I am totally off-base), meaning I would have to loop through the array and append each value to a text file every single time the function is called. Is there a better way of doing this? I am inexperienced with A2DP, but I would have assumed that the bytes of digital audio data were stored into the 'data' array one byte at a time, so (to me) it would be logical to capture these bytes wherever that takes place.

Unfortunately, since I am still new to the ESP32 environment as well as A2DP in general, I am struggling to find exactly where in the code I should modify to accomplish my specific goal. Therefore, if anyone who is more familiar with the a2dp_sink example could offer some guidance, it would be much appreciated! Thanks!