-
-
Notifications
You must be signed in to change notification settings - Fork 169
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
Voice channel audio from bot is choppy on Windows #978
Comments
The issue was initially discovered here |
What bot? Do you have code or a sample repository we can try that with? What audio? Do you have a specific file? How do you load it? |
Audio sent this way via DPP-UE doesn't seem to suffer from this issue (you can view this here). I will look into this to try find a solution (and a fix if needed). |
However, do take into account what @Mishura4 said. It really could be a setup issue on your side and we need a test case (a small bot that can replicate the issue). Check that it happens with other files too. |
Tried to replicate this, but I can't. Please follow what @Mishura4 said! |
Going through some testing I found out that there is almost no stuttering when data is send via |
Here is how I am able to produce the problem:
|
It appears we may already have a fix for this. Please read this awfully wordy but detailed description of send_audio_type_t in the discordvoiceclient. Switching the value of this member variable to overlapped audio will get rid of the stutter. Others working with voice have already had, and created workarounds for these issues which seem to be as you said problems with accuraccy or resolution of some systems chrono implementations. |
in short the important note is here at the bottom: There are some inaccuracies in the throttling method used by the recorded audio mode on some systems (mainly Windows) which causes gaps and stutters in the resulting audio stream. The overlap audio mode provides a different implementation that fixes the issue. This method is slightly more CPU intensive, and should only be used if you encounter issues with recorded audio on your system. |
Yes, it fixes the issue. Could be nice if this function was mentioned in examples for new Windows developers in the future. |
We could potentially pin this issue 🤔 |
why don't we just default the audio type to overlapped on windows? the cpu usage talked about in the comment is minimal enough that nobody will notice, when they talk about it using more CPU they mean on the game dev kind of levels of CPU usage, like a few extra nanoseconds... |
Sounds even better to me! More than happy to approve that. |
Sorry to necro, the PR #1004 now implements what we discussed @braindigitalis. |
Git commit reference
3d1318c
Describe the bug
When Bot is run on Windows, audio sent in voice channel is choppy. It sounds like bot is late every time it needs to send next Opus audio frame. It may be an issue with Microsoft's C++ STD library implementation of
std::high_resolution_clock
.When the same exact code is run on Linux, audio is crystal clear.
To Reproduce
Steps to reproduce the behavior:
send_audio_opus()
orsend_audio_raw()
Expected behavior
Bot should play audio on Windows the same way it does on Linux
System Details:
The text was updated successfully, but these errors were encountered: