0

There's a well-known software bug in Windows and macOS audio driver's of Apple's laptops released since 2019: a random pop or popping sound during media playback and a pop sound when media is stopped/paused (i.e. see 2019 and 2017). On 2019 16-inch MacBook Pro with Boot Camp with Windows 10 version 21H2 popping during playback happens only in case Dolby Atmos or Equalizer APO system-wide equalizing is unitized, but the quality of sound is unacceptable otherwise.

Somebody reported playing audio with 0 volume in the background solves the second part of the problem in macOS. I tested this fix to be working in Windows 10 running on my 2019 16-inch MacBook Pro: I used two instances of VLC, one with a looped silent quarter-second WAV audio file from archive.org, another instance playing audio/video in a regular manner. 100% time no more popping when media is stopped/paused with or without system-wide equalizing.

It appears audio driver is being forced to idle by Windows 10 too aggressively. I tried specifying a PerformanceIdleTime to 00 00 00 00 for audio driver (explanation) but for some reason Windows 10 version 21H2 does not respect this for AppleAudio.sys and this doesn't work (maybe AppleAudio.sys versions 6.1.8000.1-6.1.8000.3 are faulty). So far to keep fix as lightweight as possible the best thing I figured is to play silent WAV stream loop in RAM using PowerShell in the background like this (method combined from this answer, this thread, this Reddit post):

# Make the Base64 string that would be saved in the PowerShell script file
$WAV = [IO.File]::ReadAllBytes("C:\quarter-second-silence.wav")
$Base64WAV = [Convert]::ToBase64String($WAV)
$Base64WAV > C:\quarter-second-silence.txt
(copy output from C:\quarter-second-silence.txt using Notepad)

# Return the Base64 string to a byte array;
# also you can save the following code as PS1 file
# and execute from PowerShell via "& C:\Script.ps1"
# or better create a scheduled task to play hidden loop at log on
# as described further; be sure first to check if this helps by
# executing commands one-by-one in PowerShell and don't close
# PowerShell window after last command during test run
# (before making a Script.PS1 file)
$ConvertedWAV = [System.Convert]::FromBase64String("<paste copied output>")
$MemoryStream = [System.IO.MemoryStream]::new($ConvertedWAV)
# Loop playback of the returned string
$SoundPlayer = [System.Media.SoundPlayer]::new($MemoryStream)
$SoundPlayer.PlayLooping()

PowerShell script can be executed in background at user log on, and in this particular case the PowerShell task can be safely hidden for silent sound to be actually played in the background (so all you get is a PowerShell process in Task Manager, no extra flashing windows, no extra icons in taskbar or system tray). To execute PS1 file on startup completely silently, create a new task in Task Scheduler with the following action executed as hidden at user log on (you can use shortcut with the following target): %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -file "C:\Script.ps1" (When creating task action and copy-paste this code, Task Scheduler will ask if you'd like to use command arguments, agree to that.)

Script containing Base64-encoded WAV has a file size of ~58 KB and the PowerShell background task uses ~1.4 MB of RAM while running, so it's not a particularly resource-heavy solution.

However maybe there's a more elegant way to keep audio driver busy?

bananakid
  • 31
  • 6
  • I want to use this for keeping audio driver busy, because I'm using Dolby Atmos, and sometimes the audio becomes glitchy if I don't use audio output for a long time. Though if I use this, I think this will also keep PC awake. But that's ok. Also how could I see if this is still working or not. AFAIK if I close powershell the background app also closes. Because I played another media file and saw Dolby Atmos popped up. That means the background process is killed when Powershell is closed, right? – Plato Dec 20 '22 at 07:44
  • Sorry for the late response. You computer will be able to sleep as usual with this task running in background. My way to use this is to set up a new task via Task Scheduler with [these properties](https://pastebin.com/EDMMbinT). You will be able to tell if the tasks is running using bot Task Scheduler (check status) and Task Manager (look for "Windows PowerShell" process in Background Processes section of Processes tab). If it fails for some reason you can restart task via Task Scheduler (or PS1 file). Or maybe schedule automatic restart once in a while (depends on your scenario). – bananakid Jan 17 '23 at 11:10

1 Answers1

1

It turns out playing silent WAV using PowerShell (as described in my question) may cause RAM leak in paged pool: Capture (I'm not allowed to post any images yet so it's a link to PNG). This can me fixed by manually running RAMMap by SysInternals (and emptying all RAM sets and lists).

I also have discovered a solution that may be helpful for everyone with similar issue and that doesn't require scripting (this may lead to RAM paged pool leak as well): Sound Keeper by Evgeny Vrublevsky. Download ZIP, extract and rename EXE to SoundKeeperAll.exe, then execute. Sound Keeper process uses 2 MB of RAM & it's compatible with PC sleep function (you computer will sleep like a baby). EXE size of 22 KB is reasonable as well.

According to my investigation, paged pool memory leak is related to audio driver issue (AppleAudio.sys 6.1.7600, 6.1.7700.3, 6.1.7900.1, 6.1.8100.2, 6.1.8100.3, 6.1.8100.4) on Intel Macs equipped with T2 security chip in Windows 10 version 21H2, not PowerShell or Sound Keeper. If you don't use Crapple computer you can safely use both solutions.

bananakid
  • 31
  • 6