Skip to content
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

Playback track timing drift with resampling and non-uniform buffer periods #1920

Closed
cme opened this issue Dec 31, 2023 · 0 comments
Closed

Comments

@cme
Copy link
Contributor

cme commented Dec 31, 2023

Hydrogen version * : master, at least as far back as 2021
Operating system + version : eg. macOS
Audio driver + version : CoreAudio, PortAudio.


The playback track drifts slightly in timing when resampling to a differing output frame rate if the audio driver in use requests differing buffer sizes.

This is because the calculation of the offset into the sample from the global frame unnecessarily is unnecessarily quantized to the buffer size. If any previous call to processPlaybackTrack had a different buffer size, this quantized sample index is incorrect.

This didn't get spotted because unit tests of playback track only use the non-resampled case (the resampled case is untested there), the timing error is comparatively small (approximately a buffer size) and is only present on systems with variable-length audio processing periods (ie. not JACK or ALSA).

Fix incoming, which will be accompanied with a refactor in some other audio performance work I'm working on.

cme added a commit to cme/hydrogen that referenced this issue Dec 31, 2023
Remove unnecessary buffer-size quantisation of sample start
cme added a commit to cme/hydrogen that referenced this issue Dec 31, 2023
Remove unnecessary buffer-size quantisation of sample start
@cme cme closed this as completed in 485007d Dec 31, 2023
theGreatWhiteShark pushed a commit that referenced this issue Jan 11, 2024
Remove unnecessary buffer-size quantisation of sample start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant