AudioSourceLittleFS+AudioPlayer. Looped very short sound #1946
-
Problem DescriptionHello. I use RP2040. I need to loop a short sound (just under 1 second). I'm sure the library cuts it off a bit from the front, but I can't figure out where. Please help me. Device DescriptionRP2040 + max98357a SketchHere is my code:
player.setAutoFade(false);
source.setTimeoutAutoNext(10);
player.begin();
AudioSourceLittleFS.h:
virtual Stream *nextStream(int offset = 1) override {
file.seek(0);
return file ? &file : nullptr;
} Other Steps to ReproduceNo response What is your development environmentVS Code + Arduino Community Edition plugin I have checked existing issues, discussions and online documentation
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If you just want to loop over a file I suggest you use the FileLoop class: this is less complex and more efficient. Please not that the AudioSource also adds a default timeout to determine if it has ended see setTimeoutAudioNext() |
Beta Was this translation helpful? Give feedback.
If you just want to loop over a file I suggest you use the FileLoop class: this is less complex and more efficient.
Not sure if you can do this for very short mp3 files sine the segements usually depdend on the prior segements.
So if mp3 is the culprit, I suggest to switch to wav...
Please not that the AudioSource also adds a default timeout to determine if it has ended see setTimeoutAudioNext()