New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unclear behavior of sources scheduled at fractional sample frames #332
Comments
Thanks for looking into this. I'd appreciate if you also looked into the loop start and end points for the AudioBufferSourceNode - subsample precision seems kind of unnecessary :) |
Gecko 30 should do better with buffer sample rates differing from the context That's just what worked well and didn't add any efficiency costs with the Even with buffer rate matching the context rate, unlucky positioning can still |
TPAC resolution: edit spec to stipulate that all sources are always scheduled to occur on the exact sample frame nearest to the requested time. |
The spec is silent on the consequences of scheduling a source at a time that does not fall on an exact start time of some sample frame, where such frames are imposed by the AudioContext's overall sample rate.
Experimentation suggests that current browser implementations only schedule sources on an exact sample frame boundary. In particular this represents a problem for stitching together AudioBufferSourceNodes to create seamless output when the playback rates and sample rates of these sources mean that the underlying AudioBuffer frames are not aligned with the prevailing AudioContext frames.
While subsample scheduling may seem fussy, there is an important use case (see issue cited below). Let's also note that AudioBufferSourceNodes are already dealing with cases where the underlying AudioBuffer has a different sample rate from the AudioContext. Thus dynamic resampling of audio buffers is an integral part of all existing implementations. On the other hand, one would not want small errors in scheduling times to force the engine to perform expensive-but-inaudible resampling just to reflect start times that lie slightly off of an exact sample frame. So perhaps this behavior needs to be controllable by developers.
A prior issue concerning lack of support for continuous, seamless audio appears to be related:
#265
The text was updated successfully, but these errors were encountered: