-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
With the way that the node addon is currently setup in symboxtra/SplitSound, the WebAudio ScriptProcessor node clocks its reads at a perfect rate as HulaLoop ring buffer is filled. This is desirable because we never get underflow or overflow or have to sleep, but it creates a problem if we ever miss a read or slow down, which inevitably happens.
Once the ring buffer fills during that hiccup, the reader will never catch back up to real time. Right now, this can introduce up to ~.8s of latency into the stream which will remain until the ring buffer is drained.
This would apply to other clients as well and would prevent their buffers from getting stale.
TODO
- Add a setting to
HulaAudioSettingsthat sets the aggressiveness of this feature - Default to the least aggressive mode
- Add a
getReadAvailable()method toHulaRingBufferthat returns the number of available samples - Add a check in
NodeAddon::readBufferthat watches for build up that exceeds the threshold determined by the aggressiveness setting
Possible thresholds
- Percentage of buffer that should be allowed to be full. Range:
[.1, 1.0]
if readAvailable >= thresh * bufferSize: drainBuffer
Related to: symboxtra/SplitSound#1