spdiv and fft simultaniously #1582
-
First THX for the big library, It covers a lot of use cases though the documentation is hard to plow through as there are examples linked in the wiki which seems outdated. I guess somewhere in the process of switching more to a stream API approach things got mixed up. anyway.. it might be even that the FFT gets wrong values fed in the writeDataStream() function. Could it be that it uses the spdiv stream as input idk because i get weired noise behaviour in the upper bands if i sum up bins to bands logarythmicaly and using an Sinewave generator over bluetooth. then i get logarhytmical increasing noise values in the order of the magnitudes themself. might be that the overhead of the spdiv stream gets interpreted in the fft too. here is my complete code so far maybe someone can give me a hint if i initialize the instances correctly :) #include "AudioTools.h" //DEFINITIONS //RGB //FFT-Related int peakbar = 0; //Timer_Values unsigned long disp_fps_timer = 0; //frame limiter timer unsigned long animation_timer = 0; //times the animationwindows bool animationflag = false; //toggle animationscreen //RGB-Values //*RGB-Fade_direction_registers AudioInfo info(44100, 2, 16); // Provide data to FFT void setup() { pinMode(PIN_RED, OUTPUT); //Display-Initializing // setup output // Setup FFT // Start Bluetooth Audio Receiver void loop() { //FFT Processing //window flow Disp related if ((millis() - disp_fps_timer) > disp_fps_timer_update_interval) { int bands[16][2] = { // load fft result for (int i = 0; i < 16; i++) { //RGB-FADE-LOOP red_value = red_value + rDir; if (red_value >= 255 || red_value <= 0) { if (green_value >= 255 || green_value <= 0) { if (blue_value >= 255 || blue_value <= 0) { |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I am sorry, I don't quite understand your problem:
Did you test that your log calculation logic is correct and fast enough ? I would not recommend to do this in the audio task and move it out and call it from the loop. All a2dp examples have been moved to the communications folder: Please let me know which links are broken, so that I can correct them! Finally I highly recommend to consider the advice given here |
Beta Was this translation helpful? Give feedback.
-
There is no difference performance wise! So Just do what makes most sense to you. It is quite recent that you can define the output class for a BluetoothA2DPSink, so before that you were forced to do all output via the callback. However in all cases you need to be careful and make sure that your fft processing is fast enough. ps. BluetoothA2DPSink a2dp_sink. w/o output class is using the legacy output logic |
Beta Was this translation helpful? Give feedback.
I am sorry, I don't quite understand your problem:
Did you test that your log calculation logic is correct and fast enough ? I would not recommend to do this in the audio task and move it ou…