A Magisk / KernelSU module that eliminates the 500 ms audio session lag when resuming media playback in Windows Subsystem for Android (WSA) or on any other device on which you use this module.
I am not responsible for bricked devices, dead SD cards, thermonuclear war, or you getting fired because the alarm app failed. Please do some research if you have any concerns about features included in this module before flashing it. YOU are choosing to make these modifications, and if you point the finger at me for messing up your device, I will laugh at you!
WSA's audio bridge between Android and Windows enters a sleep state after approximately 5 minutes of audio inactivity. When media playback resumes, the bridge takes ~500 ms to reopen (openOutputStream latency confirmed at 516 ms via AudioFlinger). This causes a noticeable stutter and audio/video desync on every cold resume. It may also benefit other virtualized Android environments (such as emulators) where the audio HAL has a high cold-start latency. On physical Android devices, the improvement is unlikely to be noticeable as hardware HAL latency is typically under 50 ms.
On boot, the module starts a persistent background process that plays an inaudible 15Hz sine wave through STREAM_SYSTEM at a very low amplitude. This keeps the WSA audio bridge active at all times without interfering with media playback or system volume controls.
- Waits for the device to fully boot.
- Launches
AudioKeepaliveviaapp_processusing a precompiled.dex. AudioKeepaliveopens anAudioTrackonSTREAM_SYSTEM(48000Hz, stereo, 16-bit) and continuously writes a 15Hz sine wave buffer.- If the process exits for any reason, it is automatically restarted after 3 seconds.
- Download the latest release.
- Flash it via Magisk, KernelSU, or KernelSU Next.
- Reboot.
- Verify via:
adb shell ps -A | grep app_process— you should see the keepalive process running. - You're all set!
- If you experience any issues, please open one through the Issues panel.
Requirements: JDK 8+, Android SDK build-tools (for d8), Android SDK platform (for android.jar).
# Compile
javac -source 8 -target 8 -cp /path/to/android.jar src/AudioKeepalive.java
# Convert to dex
d8 --release --min-api 26 --output . AudioKeepalive.class
# Output: classes.dex → rename to audio_keepalive.dex and place in module rootUninstalling the module via Magisk/KSU Manager and rebooting will automatically stop the keepalive process.
- Android 8.0+
- Magisk or KernelSU or KernelSU Next