A great programming exercise that forces you to wrap your head around JavaScript timing events is writing a small step sequencer that can be used while it is running with minimal latency.
A great programming exercise that forces you to wrap your head around JavaScript timing events is writing a small step sequencer that can be used while it is running with minimal latency.
It turns out that this is currently true [0] because the base audio context (BAC) time is accurate to within 20us whereas RAF is accurate to within 1ms [1]. However in future browser versions the default sensitivity for BAC is going to drop to 2ms. This is done to help improve user privacy by hampering browser fingerprinting.
This is all configurable and its materiality depends on use case, but interesting read: thank you.
[0] https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioCo...
[1] https://developer.mozilla.org/en-US/docs/Web/API/window/requ...