espnow latency to long... #348
-
Hello, Thanks, Michael |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments
-
I would play around with the I2S buffer size parameters and the copy size: https://github.com/pschatzmann/arduino-audio-tools/wiki/Performance |
Beta Was this translation helpful? Give feedback.
-
cool! I will try that. Thanks again! |
Beta Was this translation helpful? Give feedback.
-
I tried to isolate the source of the latency. So I created a sketch with just one audiokit, input->output. I could not get the latency from in to out below 64msecs, which is not a good value. I was expecting less than 10msecs, since there isn't any transformation going on. I use a oszilloscope to measure the lag between the analog input and analog output, using a short klick sound. |
Beta Was this translation helpful? Give feedback.
-
Did you use an Audiokit (with an ESP32) or a ESP8388 ? Google provided me with the following:
I would suggest that you try the excercise also with an ESP32, but I don't think that you will get below 10msecs on such a cheap platform and you will never get the floating point performance of a M7. The ESP32 should be similar with an STM32M4 I try to avoid floating point operations, but this is not always possible. Just this week I did some performance comparison for the STK framework which is based on floats |
Beta Was this translation helpful? Give feedback.
-
ok, I get the (floating-) point :-) here is the code: #include <AudioKitHAL.h> AudioKitStream kit_in; StreamCopy copier(kit_in, kit_in, 128); // copy data from kit to kit // Arduino Setup auto cfg = kit_in.defaultConfig(); // start I2S kit_in.begin(cfg_i2s); Serial.println(); } // Arduino loop - copy sound to kit copier.copy(); } |
Beta Was this translation helpful? Give feedback.
-
Hmm, If you have a regular ESP32 you could test the latency added by the ES8388 by just sending the output to AnalogAudioStream. Via google I found some other projects that indicate that the latency should be just a few ms. So there is definitely something strange going on! See https://github.com/garygru/yummyDSP - but that was for a AC101... Oh...I think you messed up your code a bit. Delete the invalid and not used auto cfg = kit_in.defaultConfig(); and adjust the parameters on cfg_i2s |
Beta Was this translation helpful? Give feedback.
-
oh, yes thanks , well spotted. Too much editing.. |
Beta Was this translation helpful? Give feedback.
-
I think I found an explanation for the 'strange' behaviour of the latency.
these values are not overwritten by the macros for the i2S buffers. |
Beta Was this translation helpful? Give feedback.
-
I never noticed: This is definitely a bug! Will you share your results ? |
Beta Was this translation helpful? Give feedback.
-
I did not try many combinations of config values. With 32000 samples, 16bit , a buffersize of 128 and a buffer_count of 2 I could get 8msecs end to end. That's hardly noticable, very good. This is using am AudioKit for input and output. I am not sure if this takes 2 dma buffer lines then? |
Beta Was this translation helpful? Give feedback.
-
Oh, cool! I did not know that it is possible to go that low! The current I2S settings are mostly driven by the internet radio streaming which is more reliable, the bigger the buffer. |
Beta Was this translation helpful? Give feedback.
I would play around with the I2S buffer size parameters and the copy size: https://github.com/pschatzmann/arduino-audio-tools/wiki/Performance
I am not sure how much lag is coming from the network...