ESP32 BT Analyser #443
-
Relatively new to using ESP32 and a novice. I would like to develop a ESP32 based system that takes via BT audio music from a desktop computer, plays the music through I2S board and also allows me to access the data stream for FFT processing and then pushing through GPIO's to a relay board in analyzer style of function. Attempts to date I have been able to connect and play music using audial to the ESP32 and attached speaker / amp. When I try and use any code to access and use the music data-stream I have been unsuccessful. Would appreciate any advice, code or alternative projects that may assist. Again I have limited experience so be kind |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
FFT expects an array of float (in the range -1.0 to 1.0) as input. A2DP provides 2 channels of int16_t data as output (where you have Left1, Right1, Left2, Right2...) so if you want to program this yourself you need to convert the data. Taking the example in the Wiki into consideration you can just do the followig in the A2DP callback: fft.write(data, size); But please notice that when you use the result by some (slow) function which performs GPIO you might need to do this in a separate task (e.g. the loop task) |
Beta Was this translation helpful? Give feedback.
FFT expects an array of float (in the range -1.0 to 1.0) as input. A2DP provides 2 channels of int16_t data as output (where you have Left1, Right1, Left2, Right2...) so if you want to program this yourself you need to convert the data.
Using the AudioTools library you can use FFT like any other data sink and just write you audio input data to it.
Further details can be found in the Wiki
Taking the example in the Wiki into consideration you can just do the followig in the A2DP callback: fft.write(data, size);
But please notice that when you use the result by some (slow) function which performs GPIO you might need to do this in a separate task (e.g. the loop task)