Ways to implement continuous looping of wav file with no gaps or delays #768
-
As the tittle suggests, I am looking for ways to implement continuous looping of a single wav file with no gaps or delays. I am using AudioPlayer.h So if the ending block has data for 300 out of 1024 I want to fill the remainder with the beginning of the file. I would appreciate any suggestions. Timm |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 8 replies
-
a) You would implement a subclass of AudioStream that implements your looping logic using a file as input. |
Beta Was this translation helpful? Give feedback.
-
Thanks, I will work on that. |
Beta Was this translation helpful? Give feedback.
-
With the latest commit I have added a file looper with an example. I suggest that you also read the class documentation and have a look at the example. For the AudioSourceCallback there is already an example that you can use as starting point. |
Beta Was this translation helpful? Give feedback.
-
Check the wiki of the https://github.com/pschatzmann/arduino-audiokit/wiki |
Beta Was this translation helpful? Give feedback.
-
I think I found where the issue is. the AudioPlayer But in the AudioSourceCallback Class in AudioSource.h, it looks like "selectStream(index)" returns nullptr because indexStreamCallback is nullptr
|
Beta Was this translation helpful? Give feedback.
-
Just committed the following logic which makes the selectStream optional: /// Returns selected audio stream
virtual Stream* selectStream(int index) override {
LOGI("selectStream: %d", index);
if (indexStreamCallback==nullptr){
LOGI("setCallbackSelectStream not provided");
if (index>0) begin();
return nextStream(index);
}
return indexStreamCallback(index);
} I also tested and updated the example |
Beta Was this translation helpful? Give feedback.
a) You would implement a subclass of AudioStream that implements your looping logic using a file as input.
b) You would implement an AudioSource (e.g. using the AudioSourceCallback) that returns a)