vrubleg / soundkeeper

Prevents SPDIF/HDMI digital audio playback devices from sleeping.
https://veg.by/projects/soundkeeper/
MIT License
213 stars 9 forks source link

Feature Suggestion: Kill SoundKeeper on Workstation Lock, Start it again on Workstation Unlock #12

Open mackid1993 opened 6 months ago

mackid1993 commented 6 months ago

I have a feature suggestion to perhaps help with sleep issues. Perhaps an option can be added for SoundKeeper to create two scheduled tasks in Task Scheduler. One to kill the process on workstation lock, to help with automatic sleep issues and another to start SoundKeeper back up on Workstation Unlock.

I've done this manually with two batch files and it works quite well. At least with Windows 11 the screen will automatically shut off if audio is playing allowing the workstation to lock and SoundKeeper to be killed. Once the workstation is unlocked SoundKeeper will start up again. At least on Windows 11 this should help with sleep issues.

vrubleg commented 6 months ago

It was one of the things that I considered, but it's not flawless. For example, when my workstation is locked, I expect to hear notifications from IM apps, and without Sound Keeper these short sounds will be cut.

I may add it as an option in the future.

mackid1993 commented 6 months ago

It's a good option for a laptop perhaps. That's my use case.

vrubleg commented 6 months ago

If your system is configured to go into sleep mode when laptop lid is closed, streaming any audio shouldn't prevent your system from sleeping.

Sipu commented 3 months ago

@mackid1993 you should be able to accomplish this by creating a task in task scheduler that triggers "on workstation lock of any user" that kills the process using taskkill for instance, and vice versa, restarts it on logon / unlock. It doesn't necessarily need a software feature at all. You can implement all kinds of complex event based scenarios using task scheduler pretty easily.

vrubleg commented 3 months ago

There is the soundkeeper kill command to shut it down gracefully.

Sipu commented 3 months ago

@vrubleg cool, yeah i see it's buried in the changelog but it's not documented in the read me. Please fix the docs and it would be super helpful to have a /? help usage switch. The current docs say The program doesn't have GUI. It starts to do its job right after the process is started. To close the program, just kill the soundkeeper.exe process. :)

Sipu commented 3 months ago

Also, thanks for making this tool. I just bought the Q Acoustics M20 HD's for my PC and the USB seems to be a glorified s/pdif and when the signal goes dead, the speaker kills the amp and it comes alive with an annoying pop every time audio playback starts. Glorious sound, but unusable without your tool :)

mackid1993 commented 3 months ago

you should be able to accomplish this by creating a task in task scheduler that triggers "on workstation lock of any user" that kills the process using taskkill for instance, and vice versa, restarts it on logon / unlock. It doesn't necessarily need a software feature at all. You can implement all kinds of complex event based scenarios using task scheduler pretty easily.

I actually did this but I had to stop using SoundKeeper as keeping the audio hardware active all of the time was shaving 2 hours off the battery life of my laptop 🙁It's a shame because it stopped the audio popping issues when the hardware woke up.

vrubleg commented 3 months ago

OMG, is it your DAC so power hungry? What model do you have?

mackid1993 commented 3 months ago

It's a Surface Laptop Studio 2.

On Tue, Jun 11, 2024, at 5:32 PM, Evgeny Vrublevsky wrote:

OMG, is it your DAC so power hungry? What model do you have?

— Reply to this email directly, view it on GitHub https://github.com/vrubleg/soundkeeper/issues/12#issuecomment-2161632777, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABO43M72SBHIS7JQNNTGH5DZG5UHHAVCNFSM6AAAAABJBC263GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRRGYZTENZXG4. You are receiving this because you were mentioned.Message ID: @.***>

vrubleg commented 3 months ago

Oh, that's weird. Laptops usually have class D amplifiers that are very energy efficient. 2 hours off sounds like too much. How did you measure?

mackid1993 commented 3 months ago

Both with running powercfg /batteryreport and watching the idle drain with Passmark batterymon with and without SoundKeeper running.Message ID: @.***>

vrubleg commented 3 months ago

Did you try the OpenOnly mode? That just opens the audio device but doesn't stream anything.

mackid1993 commented 3 months ago

Did you try the OpenOnly mode? That just opens the audio device but doesn't stream anything.

That helps the battery issue, but not the audio popping. I'm going to try running it stock and benchmark it a little bit better because it really does solve all of my audio problems.

mackid1993 commented 3 months ago

It seems like OpenOnly is the way to go. Drain is much less, the popping actually happens but it's more of a pop and less of a crackle so it's worth the tradeoff! Thanks for your help VEG!

vrubleg commented 3 months ago

I wanted to clarify further what actually you are using?

mackid1993 commented 3 months ago

I wanted to clarify further what actually you are using?

  • Built-in speakers?
  • Wired headphones?
  • Bluetooth headphones?

Sorry I'm using the built in speakers on my Surface Laptop Studio 2.

vrubleg commented 3 months ago

This is really wild that built-in speakers have this issue.

mackid1993 commented 3 months ago

Yup leave it to Microsoft!

mackid1993 commented 3 months ago

@vrubleg So I tested a little more. SoundKeeperZero.exe seems to stop the popping and also lets the battery drain drop a little bit lower at idle.

Hopefully Microsoft will eventually fix this with a driver or firmware but my hopes aren't high.