-
Notifications
You must be signed in to change notification settings - Fork 34
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
Buffer underrun symptoms on Windows 10 #46
Comments
John, The fix you described totally makes sense, though I'm surprised the issue came up. I had though the default buffer size was pretty generous for modern system (though there are always exceptions). I have wondered in the past whether this would come up and thought it might be smart to make the buffer size more dynamic. My first though was making that configurable by way of an environment variable since whatever setting works best will probably correlate with a particular system (OS, CPU, memory, background applications, etc) and would ideally be configurable without having to modify code (for users of the application/script in question who aren't developers). What are your thoughts on potential solutions? I'd also welcome any information on potential bugs! Thanks! -Joe |
My machine is an i7-3770 which although an old-ish machine, is still pretty competitive performance-wise. Allowing configuration via some environment variable sounds sensible, though I suspect that a modest increase in the buffer for everyone might actually be enough -- maybe 0.05 seconds is so short as to be affected by the task scheduler timeslice, or something like that. FWIW, the code I'm using here at the moment actually looks like
(i.e. rather than multiplying by 2 as per the original comment, I've eliminated the division by NUM_BUFS, which comes to the same thing). The other two potential issues are that (a) I think that in fill_buffer() the replacement
if probably a good idea, and (b) At the end of play_os() I think this replacement might be safer...
Hopefully the comments adequately explain the motivation for these changes, but if not I'm happy to discuss them further. I'm also happy to submit a proper pull request, if you like, but didn't want to do that to start with in case you assumed they were properly considered changes, rather than suggestions for your consideration! John |
Hello, I'd just like to bump this thread since I've been experiencing this issue for a long time now. Let me know if there's anything I can help with. I'm not well-versed in hardware-related C, but maybe I can run tests on my end (or something else you might have in mind). Here are some details in case that's relevant:
Thanks! |
Hello,
I'm using simpleaudio on Windows 10 to play a sound using code like
and I often get broken-up sound. Looking at a recording of that sound, I see that it plays properly for some multiple of 0.05 seconds, then a short gap of silence is inserted, then playback resumes.
I experimented with the code, and found that changing
to
in the function play_os() in simpleaudio_win.c (i.e. doubling the size of the buffers) was enough to make the problem stop happening, at least on my system.
Whilst investigating this problem, I also found (I think) two other potential ways in which sound corruption might occur, which I would like to offer for your consideration. It's possible I'm wrong about these, though, since I'm not very familiar with your code.
What's the best way of progressing this?
Cheers,
John
The text was updated successfully, but these errors were encountered: