strudel
strudel copied to clipboard
sample preloading query loop
Currently, samples are lazily loaded when they are first needed. for most samples, this leads to unwanted silence, because the loading takes longer than the 100ms latency. It would be pretty useful if there was a separate query loop that preloads the samples with a higher latency, say x seconds. To ensure there is always at least a buffer of x seconds between preloading and playback, the initial play action would then need to query the first x*2 seconds. Then, after x seconds, the next x seconds are loaded and so on.
with the offline support, this is partly solved because once you have sample, it will load almost instantly through the service worker
I am using mp3s instead of wavs due to this issue, would be great to have a solution
How would it work? await samples(..., preload=True)
? and then only start playing back once loading is complete?