-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add option to reduce audio latency using scrcpy #22
Comments
i'd have to read up on it and wrap my head how to implement it on the script. |
Does 20 audio buffer crackle on your end? I tried it with Project Sekai and it worked fine for me. (plus it just manages to work with the game's -20/20 limit) If it doesn't crackle, then it might be a good default for the buffer if this gets implemented. |
At 20 I noticed some infrequent popping, although I didn't notice any at 25. |
I think i know how to add this to the script. Will there be any negative effect if default to 25? |
I didn't notice any issues when set to 25, but I haven't done any extensive testing. |
So I originally glanced over this in the original Waydroid issue since they said they had "little success", but in my testing it at gets audio latency down much closer to Overlaying on init
export PULSE_LATENCY_MSEC 60
export PIPEWIRE_LATENCY 24/48000 reduces latency significantly. I tried setting @ActualMandM how would you say this compares to |
Here's my findings using scrcpy and cytoid - without scrcpy - 0.429s offset So it looks like the sweet spot is the 30 buffer? It could also be my version of scrcpy. The one from pacman repo is old 2.0.x and doesnt support the no-video-playback parameter. I build from git source to get the latest 2.3.x. What version do you guys use for scrcpy and where did you get it? |
here's how to have scrcpy launch automatically in Game Mode - create a file - /usr/bin/waydroid-fix-audio and make the file executable. Contents of the file - Edit the file ~/Android_Waydroid/cage_helper.sh and add at the end - sleep 5 Make sure USB debugging is enabled and always accept the connection from Steam Deck. Please test and i can add this to the next version. |
Using the overlay audio.rc method the cytoid offset shows 0.171s I used this - So i guess this is the way to go? Much cleaner too as no extra binaries needed, and my audio is not faint compared to when scrcpy is enabled. |
I installed it from |
I had to turn the volume back up in settings once connecting scrcpy. I grabbed v2.1 from the Arch Linux archive because the latest version gave me an outdated glibc error. |
I probably should've test it with it set to 0, whoops! It seems to sync up pretty well once doing that. Will need to test with a song though to be sure. EDIT: Testing with a song, I still need the delay set to -20 but at the very least I don't need scrcpy to get that result now (both with |
I'm leaning on the audio.rc method too as no extra binaries needed. |
Yeah, using the |
Awesome. What willl be the best default values to include on the script? Moving forward I plan to include a "waydroid toolbox" that user runs in Desktop Mode if they want to change the default values. It will just be a simple zenity-based menu and user can choose - disable / enable custom host file |
I'd probably go with either
|
50msec and 32/48000 resulted in 0.164s. sweet! |
pushed the proposed config and updated the installer script. |
Waydroid appears to have a significant amount of audio latency, to the point where rhythm games become impossible to play unless you adjust the audio latency in the game's settings.
By using
scrcpy
, you can significantly reduce the amount of audio latency.Using the game Cytoid as an example, here's the amount of measured end-to-end latency in the game's calibration tool when using Waydroid's audio playback:
When running
scrcpy --audio-buffer 30 --audio-codec=raw --no-video-playback --tcpip=[WAYDROID_IP_ADDRESS]:5555
via SSH I measured the following latency:For a rough idea of how this compares to an actual Android device, I ran the same test on my Sony Xperia 1 II.
This results in roughly half the end-to-end audio latency of Waydroid's native audio output, and brings things much closer to an actual Android device. I tried lower values for
--audio-buffer
, but it resulted in some noticeable popping in the audio. I haven't noticed any issues in more demanding games that I have tested, but despite that it might be best to make such a feature default off just in case.The text was updated successfully, but these errors were encountered: