Sound Keeper v1.3.3 [2023/08/19]

Prevents SPDIF/HDMI digital audio playback devices from sleeping. Uses WASAPI, requires Windows 7+. It doesn't have GUI and starts to do its job right after the program is started. To make it autorun, copy the soundkeeper.exe into the startup directory that you can access by pressing Win+R and entering shell:startup. To close the program, run the soundkeeper.exe kill command or just kill its process.

Download: soundkeeper.7z (23KB). Source code →

The archive contains two versions:

  • SoundKeeper32.exe is for x86-32 versions of Windows.
  • SoundKeeper64.exe is for x86-64 versions of Windows. The most popular variant.
  • I could make native ARM64 version, but I need somebody with such machine for testing it before releasing.

There is also a debug version that outputs all debug logs into a console window. Please show the logs when you report issues.

Features

  • Sound Keeper is fully automatic and doesn't require any user interaction.
  • Supports keeping on multiple sound outputs (e.g. an SPDIF and an HDMI).
  • Detects new sound outputs on the fly (e.g. when you connected a TV via HDMI).
  • Supports various stream types that should help in all possible cases.

Settings

Default behavior can be changed by changing file name of the Sound Keeper executable (just add desired settings to the Sound Keeper file name) or by passing them as command line arguments. All settings are case insensitive.

Primary audio output is used by default. If current primary audio output has changed, the Sound Keeper detects this and switches to the new output automatically. If you want to run Sound Keeper on all enabled audio outputs, just add All to executable file name to enable Sound Keeper on all outputs.

All supported audio output type modes:

  • Primary keeps on primary audio output only. It is used by default.
  • All keeps on all enabled audio outputs.
  • Digital keeps on all enabled SPDIF and HDMI audio outputs (like it was in Sound Keeper v1.0).
  • Analog keeps on all enabled audio outputs except SPDIF and HDMI.

Inaudible stream of zeroes with infrequent smallest possible non-zero samples (fluctuations) is used by default. Add Zero to executable file name to use stream of zeroes only.

All supported stream types:

  • OpenOnly opens audio output, but doesn't stream anything. Sometimes it helps if it's a driver only issue.
  • Zero plays stream of zeroes. It may be not enough for some hardware.
  • Fluctuate plays stream of zeroes with the smallest non-zero samples once in a second. Used by default.
  • Sine plays 1Hz sine wave at 1% volume. The frequency and amplitude can be changed. Useful for analog outputs.
  • White, Brown, or Pink play named noise, with the same parameters as the sine (except frequency).

If the default inaudible stream doesn't help, try the new Sine stream type. It generates a sine wave, and can be customized. There are two parameters: F (frequency) and A (amplitude). The value goes right after the parameter character. For example, add SineF10A5 to executable file name to generate 10Hz sine wave with 5% amplitude. Low frequencies (below 20Hz) and high frequencies (above 20000Hz) with low amplitude (up to 10%) are inaudible.

Stream parameters:

  • F is frequency. Default: 1Hz for Sine and 50Hz for Fluctuate. Applicable for: Fluctuate, Sine.
  • A is amplitude. Default: 1%. If you want to use inaudible noise, set it to 0.1%. Applicable for: Sine, Noise.
  • L is length of sound (in seconds). Default: infinite.
  • W is waiting time between sounds if L is set. Use to enable periodic sound.
  • T is transition or fading time. Default: 0.1 second. Applicable for: Sine, Noise.

Examples:

  • SoundKeeperAll.exe generates default inaudible stream on all enabled audio outputs.
  • SoundKeeperZero.exe generates zero stream on primary audio output.
  • SoundKeeperAllZero.exe generates zero amplitude stream on all enabled audio outputs.
  • SoundKeeperSineF10A5.exe generates 10Hz sine wave with 5% amplitude on primary audio output. It is inaudible.
  • SoundKeeperSineF1000A100.exe generates 1000Hz sine wave with 100% amplitude. It is audible! Use it for testing.
  • SoundKeeper.exe sine -f 1000 -a 100 is command line version of the previous example.
  • SoundKeeper.exe brown -a 0.1 generates brown noise with 0.1% amplitude.

What's new in v1.3.3

  • Fixed arguments parsing bug: All or Analog after specifying stream type led to amplitude set to 0.

What's new in v1.3.2

  • Fluctuate treats 32-bit PCM output format as 24-bit since WASAPI reports 24-bit as 32-bit for some reason.
  • Fluctuate generates 50 fluctuations per second by default. It helps in many more cases.
  • Sound Keeper doesn't exit when it is muted.

What's new in v1.3.1

  • A potential deadlock when audio devices are being added or removed has been fixed.
  • Fluctuate treats non-PCM output formats (like Dolby Atmos) as 24-bit instead of 16-bit.
  • Frequency parameter F is limited by half of current sample rate to avoid generation of unexpected noise.
  • More detailed logs in debug build. Debug output is flushed immediately, so it can be redirected to a file.

What's new in v1.3.0

  • Fluctuate is 1 fluctuation per second by default. Frequency can be changed using the F parameter.
  • Periodic playing of a sound (parameters L and W) with optional fading (parameter T).
  • New White, Brown, and Pink noise signal types.
  • Self kill command is added. Run soundkeeper kill to stop running Sound Keeper instance.
  • Analog switch was added. It works as the opposite of Digital.
  • Ignores remote desktop audio device (this feature can be disabled using the Remote switch).
  • New OpenOnly mode that just opens audio output, but doesn't stream anything.
  • New NoSleep switch which disables PC sleep detection (Windows 7-10).
  • Work as a dummy when no suitable devices found.
  • Sound Keeper shouldn't prevent PC from automatic going into sleep mode on Windows 10.
  • The program is not confused anymore when PC auto sleep is disabled on Windows 10.
  • The workaround that allowed PC to auto sleep had to be disabled on Windows 11.

Sound Keeper vs. SPDIF Keep Alive vs. SPDIF-KA

Sound Keeper v1.3 SPDIF Keep Alive v1.2 SPDIF-KA v1.4
Fully automatic: Yes No No
Multiple outputs: Yes No No
Stream types: 7 2 2
Periodicity: Yes No No
GUI: No Yes Yes
Requires .NET: No Yes Yes
Executable size: 20KB 668KB 163KB
CPU usage (on Intel Core i5 4460): 0.004% 0.06% 0.06%
RAM usage (Private Working Set): 1636KB 13704KB 10600KB

Known issue: streaming audio prevents automatic sleep mode

When a program streams any audio (even silence), the system doesn't go into sleep mode automatically. Sound Keeper uses the NtPowerInformation(SystemPowerInformation, ...) function to retrieve time when system is going to sleep, and disables itself right before this time. On Windows 7, it works perfectly. Windows 10 waits for 2 minutes more after any sound was streamed, so the PC goes into sleep mode after 2 minutes when Sound Keeper disabled itself. For some reason, Windows 11 always reports that the system is going to sleep in 0 seconds. So, the workaround had to be disabled on this OS until a better solution is found. You can try to use the powercfg to workaround this issue at the system level. Details →

  1. #351
    Kevin

    The program is very good, but there is one problem. It prevents windows from automatically standing by. My computer cannot go into hibernation. It would be nice if it was fixed.

  2. #352
    VEG Author

    Kevin, it's a known issue and it's even documented right on this page, with potential workarounds provided here. Windows doesn't go into sleep mode automatically when an audio device is being used, it's a default behavior, there is no known way to bypass it without drawbacks, so you have to choose a workaround that is suitable for you.

    This issue is related to the automatic sleep only. If you manually hibernate or sleep your computer, the Sound Keeper shouldn't prevent it.

  3. #353
    Gaël

    Well it seems that the only thing that worked was to disable Exclusive Mode in Windows sound panel. (maybe I was supposed to do that from the beginning, sorry if that's the case and I'm just a bit slow. ^^)

  4. #354
    Gaël

    Sorry, me again. Actually I'll have to let the Exclusive mode on, otherwise I won't have the proper soundtracks for the movies mixed with DTS-X or Dolby Atmos. Back to square one, I guess. :/

  5. #355
    VEG Author

    To fix this issue, I need more debugging info. Could you please follow the instructions that I provided on the previous page?

  6. #356
    Gaël

    Hi, sorry for the delay, I finally tried the debug mode, and this is what happened:

    2024/01/21 14:37:55.477 [ 8612] Sound Keeper v1.3.3.0 [2023/08/19]
    14:37:55.477 [ 8612] Enter main thread.
    14:37:55.477 [ 8612] Windows Build Number: 19045 (leaky WASAPI).
    14:37:55.477 [ 8612] Exe File Name: SoundKeeper64d.exe.
    14:37:55.477 [ 8612] Remaining time to sleeping: -31 seconds.
    14:37:55.477 [ 8612] Device Type: Primary.
    14:37:55.477 [ 8612] Stream Type: Fluctuate (Frequency: 50.000Hz).
    14:37:55.477 [ 8612] Periodicity: Disabled.
    14:37:55.477 [ 8612] Stopping another instance...
    14:37:55.492 [ 8612] Enter main loop.
    14:37:55.492 [ 8612] Starting...
    14:37:55.492 [ 8612] Getting primary audio device...
    14:37:55.492 [ 8612] Device ID: '{0.0.0.00000000}.{914378bf-f01c-400e-924b-b39a6636d72f}'. Form Factor: 9.
    14:37:55.492 [ 7340] Enter rendering thread. Device ID: '{0.0.0.00000000}.{914378bf-f01c-400e-924b-b39a6636d72f}'.
    14:37:55.492 [ 7340] Rendering thread mode: 1. Delay: 0.
    14:37:55.492 [ 7340] Render. Device State: 1.
    14:37:55.492 [ 7340] Getting output format...
    14:37:55.492 [ 7340] [WARNING] Unrecognized format: {0000000c-0cea-0010-8000-00aa00389b71} 8ch 192000Hz 16-bit.
    14:37:55.492 [ 7340] Getting mixing format...
    14:37:55.508 [ 7340] Format: PCM 8ch 48000Hz 32-bit float.
    14:37:56.050 [ 7340] Starting rendering...
    14:37:56.050 [ 7340] Enter rendering loop.
    14:38:05.352 [ 4604] Session is disconnected with reason 5. WaitExclusive.
    14:38:05.352 [ 7340] Leave rendering loop. Stopping audio client...
    14:38:05.353 [ 7340] Rendering thread mode: 3. Delay: 30.
    14:38:05.391 [ 7340] Wait until exclusive session is finised.
    14:38:05.395 [ 7340] No active sessions found, try again.
    14:38:05.397 [ 7340] Rendering thread mode: 3. Delay: 100.
    14:38:05.503 [ 7340] Wait until exclusive session is finised.
    14:38:05.504 [ 7340] No active sessions found, try again.
    14:38:05.504 [ 7340] Rendering thread mode: 3. Delay: 100.
    14:38:05.615 [ 7340] Wait until exclusive session is finised.
    14:38:05.616 [ 7340] No active sessions found, try again.
    14:38:05.617 [ 7340] Rendering thread mode: 3. Delay: 100.
    14:38:05.726 [ 7340] Wait until exclusive session is finised.
    14:38:05.727 [ 7340] No active sessions found, try again.
    14:38:05.728 [ 7340] Rendering thread mode: 3. Delay: 100.
    14:38:05.837 [ 7340] Wait until exclusive session is finised.
    14:38:05.838 [ 7340] No active sessions found, try again.
    14:38:05.838 [ 7340] Rendering thread mode: 3. Delay: 100.
    14:38:05.948 [ 7340] Wait until exclusive session is finised.
    14:38:05.949 [ 7340] No active sessions found, try again.
    14:38:05.949 [ 7340] Rendering thread mode: 3. Delay: 100.
    14:38:06.058 [ 7340] Wait until exclusive session is finised.
    14:38:06.059 [ 7340] No active sessions found, try again.
    14:38:06.059 [ 7340] Rendering thread mode: 3. Delay: 100.
    14:38:06.169 [ 7340] Wait until exclusive session is finised.
    14:38:10.212 [ 4604] State of the exclusive mode session is changed: 0.
    14:38:10.213 [ 7340] Rendering thread mode: 2. Delay: 0.
    14:38:10.214 [ 7340] Retry in 100ms. Attempt: #0.
    14:38:10.215 [ 7340] Rendering thread mode: 1. Delay: 100.
    14:38:10.316 [ 7340] Render. Device State: 1.
    14:38:10.316 [ 7340] Getting output format...
    14:38:10.316 [ 7340] [WARNING] Unrecognized format: {0000000c-0cea-0010-8000-00aa00389b71} 8ch 192000Hz 16-bit.
    14:38:10.316 [ 7340] Getting mixing format...
    14:38:10.316 [ 7340] Format: PCM 8ch 48000Hz 32-bit float.
    14:38:10.504 [ 8612] Remaining time to sleeping: -61 seconds.
    14:38:10.504 [ 7340] Starting rendering...
    14:38:10.520 [ 7340] Enter rendering loop.
    14:38:15.518 [ 8612] Remaining time to sleeping: -1 seconds.
  7. #357
    Gaël

    I should have been more specific: That was what happened when I ran the Soundkeeper debug mode, then launched a movie on VLC, then closed VLC after a few seconds. Hope that helps!

  8. #358
    VEG Author

    This debug log looks OK, and it seems like the program proceeded to work properly. You told before that only the release version was crashing. This is why I was asking here for a crash dump and a Process Monitor log recorded with the latest release version.

  9. #360
    VEG Author

    Gaël, according to the log, the program didn't crash after VLC was used. It probably just stuck if the program didn't do what is expected.

    I noticed in the path that it says soundkeeper_v1.1.0 that looks more like v1.1.0 than v1.3.3 =) Please don't use that old version. You need to use the latest v1.3.3 that has a few such bugs fixed.

  10. #361
    Gaël

    I never bothered renaming the Soundkeeper folder where I drag and drop the new versions, but I'm definitely using v1.3.3 :)
    The thing is, if, for instance, I exit VLC and try to watch a non-exclusive video like Youtube or Twitter, I'll hear the little "poc" and miss the 1st second of the audio. I have to manually restart Soundkeeper in order for this problem to be fixed, until the next use of VLC, where the problem will happen again.

  11. #362
    VEG Author

    OK, let's try to make a dump of this process that apparently stuck for some reason. Reproduce the issue and then make a dump of the Sound Keeper process (run Task Manager via Ctrl+Shift+Esc, right click on the SoundKeeper process, click Create dump file) and share it. It will be visible from the dump where the program stuck.

  12. #364
    Chris

    Hello!!! Thank you for creating this! I recently purchased an SMSL 300SE..Have two pops when a song starts, two a few after it ends...Your program works only when playing 44.1khz, not high res...is there an adjustment? And every time i restart my pc or the soundcard do I have to run your program again? Seems so..Cheers mate Thank you

  13. #365
    VEG Author

    Gaël, thanks, I'll look into it later when I have more free time.

    Chris, it should work with high sample rates too. Maybe you are talking about exclusive mode? When an audio output is used in exclusive mode, the Sound Keeper can't use it at the same time obvioulsy.

    To make it automatically starting with your Windows, copy the program into the Startup directory as it is written in the Readme file and on this page.

  14. #366
    VEG Author

    Gaël,

    TL;DR: upgrading your OS to Windows 11 should help.

    The issue is in the workaround for a Windows 10 specific issue (when any program tries to open an audio device that is already used in exclusive mode, Windows Audio Service leaks significant amount of memory). The workaround doesn't work for you as expected, I'll think what to do with this. Meanwhile, you could consider upgrading your OS to Windows 11 where the original memory leak issue is apparently fixed and the workaround is not used.

    I reported that bug to Microsoft a few years before before Windows 11 release. They fixed it, but for some reason in Windows 11 only. I expected that the bugfix would be delivered with Windows 10 updates to Windows 10, but it didn't happen. Apparently, somebody at Microsoft thinks that a memory leak is not critical enough to port the fix to Windows 10.

  15. #367
    Gaël

    Thank you for taking the time to look into it, but infortunately my computer is not W11 compatible. Oh well. :/
    Thanks anyway, and keep up the good work!

  16. #368
    VEG Author

    Gaël, you can use Rufus to make it "compatible". It's not officially compatible, but it is actually compatible with almost anything that is supported by Windows 10 =)

    Anyway, I'll look for a better workaround for the Windows 10 issue later, maybe I'll come up with something.

  17. #369
    murgi

    Thank you so much for this program, for years I had massive crackling sound/robot death-screech problems with my Denon Receiver, 4090 and LG CX - your program solved all that. Finally I can enjoy Dolby Atmos. Microsoft, Denon and NVIDIA all tried to lay blame on each other over the years... and apparently its a simple Software fix in Windows.

    Well, thank you.

  18. #370
    VEG Author

    Gaël, I updated the latest beta to make it trying the workaround for longer, maybe it helps a bit.

  19. #371
    Gaël

    Thanx Veg!
    I can definitely hear a double "pop" now when I stop an exclusive video on VLC, meaning that Sound Keeper restarts itself automatically.
    So this definitely does the trick, thank you ! :D

  20. #372
    Zach

    Does this work for DAC/AMPS that are using usb input. (DAC-X6)?

  21. #373
    VEG Author

    It should work. You always can try =)

  22. #374
    Zach

    is there anything else to it other than running it? I downloaded, unzipped and ran the program (SOUNDKEEPER64) but nothing changed. Still getting pops. Either way if it doesn't work you're an OG for still supporting this and responding so fast. I will figure this out one way or another

  23. #375
    VEG Author

    Try different modes that are described on this page, e.g. SineF1A5 or SineF10A5.

  24. #376
    Zach

    Holy crap it worked. VEG you're a gangster.

  25. #377
    VEG Author

    Also check if SineF1A1 works for you and tell the results here in the comments, so other users with the same hardware would know what they could use.

  26. #378
    Zach

    Confirmed SineF1A1 works!

  27. #379
    Hyun

    Just the app I was looking for!

    While using this app, a small suggestion came to mind, if this makes any sense.

    It's regarding the previously mentioned "windows audio device graph isolation's excessive cpu utilization"

    I'm on Win11 and have a dolby atmos soundbar hooked up via HDMI. Also have dolby atmos for home theater selected in the audio control panel.
    (disabling dolby atmos solves the utilization problem, but what's the point in having it then right XD)

    With soundkeeper running, or whenever the system plays a non-dolby atmos stream, like a youtube video or mp3 audio, windows audio device graph isolation percentage spikes(up to 20% on my N100 base htpc).

    However, strangely, the utilization drops significantly when a dolby atmos or dolby digital stream is played.
    (Bitstreamed in kmplayer. I'm not sure if this depicts an absolute utilization since percentage is relative, anyway)

    So I was thinking, if soundkeeper could generate an inaudible bit stream, could it prevent the percentage spike?

    I'm not at all knowledgable on this subject, just an observation I had while trying to troubleshoot on my own. Thanks for a great app!

  28. #380
    VEG Author

    Hyun,

    However, strangely, the utilization drops significantly when a dolby atmos or dolby digital stream is played.

    Most probably it's because when you use Dolby Atmos, your software uses exclusive mode that disables processing of the audio.

    You can try to disable all the processing for this audio output that is used in shared mode (it's when a few programs can produce sounds simultaneously). If there is nothing to disable, it might be just your system mixer that is activated whenever two or more audio streams are played simultaneously (e.g. Sound Keeper's inaudible stream and Youtube). It is not that CPU expensive to consume so much of your CPU though, so I think it does some additional processing when you use your audio device in shared mode.

  29. #381
    Hyun

    VEG,

    You're right, I checked and they are in exclusive mode. I guess it's just how it works then. I also noticed on my other pc with a 5800x3d its percentage is negligible (0~1%). Didn't realize difference in cpu performance was that big until now.
    Anyway, soundkeeper stays on. Thanks for your work!!

  30. #382
    David

    This program completely solves the popping on my Surface Laptop Studio 2 when a notification comes in or something starts playing at first. It was driving me nuts and had no idea it was a Windows issue! Does anyone know if running this on a laptop has any impact on battery life. I was able to do the powercfg workaround to get sleep working.
    Thanks!

  31. #383
    VEG Author

    David,

    Does anyone know if running this on a laptop has any impact on battery life.

    Any running app has some impact, but in case of Sound Keeper it should be negligible.

  32. #384
    Oleg

    I have connected Marshal Middleton with aux. 1.3.3 version dont disable sleep mode

    Пожалуйста помоги, на хабре писать не могу, старый топчик

  33. #385
    VEG Author

    Oleg, try non-default modes, e.g. SineF10A5 or others, something should help. Also, the newest periodicity settings could be useful if your speaker goes into sleep mode with a huge delay. All these settings are documented on this page or in the readme file.

Comments are temporarily closed.