Skip to content

ESP32 BT Analyser #443

Answered by pschatzmann
ATT150 asked this question in Q&A
Discussion options

You must be logged in to vote

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)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pschatzmann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants