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

Internal audio latency #714

triplefox opened this issue Sep 1, 2018 · 1 comment


Copy link

@triplefox triplefox commented Sep 1, 2018

When running TIC-80, across multiple platforms(Windows desktop, HTML5 player, Android), I always notice small pops and creaks when it plays sound, symptoms of frequent buffer underruns during audio playback. The current method it uses is to call SDL_QueueAudio from within the render tick and blit everything that has been rendered in that frame, which leaves the program heavily reliant on making every frame deadline every time.

Most audio programs run a separate audio thread with intentionally added frames of latency to smooth this out: instead of handing over all the samples that have been constructed right at that moment, they're repackaged into fixed-size audio frames for API consumption, and the renderer stays ahead of the API by a target number of frames. This adds a margin of safety, and the fixed size plays better with most audio APIs. Many apps also expose some user configuration options for buffer sizes.


This comment has been minimized.

Copy link

@nesbox nesbox commented Sep 2, 2018

In few words, we have to add empty buffer to the audio frames to allow slightly late for the sound system...
I'll try to add this, thanks.

@nesbox nesbox added this to the 0.80.0 milestone Sep 27, 2019
@nesbox nesbox added the enhancement label Sep 27, 2019
@nesbox nesbox self-assigned this Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.