USB Speaker disappears when computer goes to sleep

I have a USB speaker which shows up in my Audio devices. When the computer goes to sleep it often seems to drop out and disappear.

A restart of the computer or unplugging and plugging in the speaker again resolves the issue.

I’m using this device to play audio for my ZigBee which I want to work even when my computer is asleep as my primary sound system is through an AMP that switches itself off after some time.

If the computer is in ‘sleep’ mode, this should be self-explanatory. Devices are also powered down, or otherwise paused. This is how it should be. To have it any other way entails not putting your computer to sleep.

Perhaps you should search for ‘Caffeine’ which keeps your computer awake. Alternatively, do some research on the various Power Saving options available in Linux; there are differing states; maybe ‘Suspend’ might be an option. Cheers.

You can do it like I do mine:

After 2 minutes’ inactivity, KDE turns off screen.

I use xidlehook, from the extra repositories to, 8 minutes after that, suspend my computer if inactive.

That’s a classic old tune … wait, nevermind.

1 Like

thanks for the info guys. I’ll do some further investigating

I’ve done more thinking about this and it still doesn’t make sense. My wireless keyboard plugs in via usb and can always wake up the computer.
Likewise my zigbee is controlled via USB stick and works when the computer is asleep (screen is off).
So why should my usb speaker be any different?

The screen being off doesn’t always mean the computer is in sleep mode – it only means the screen is off.

Your wireless keyboard wakes up the computer. Fine. This means it was either in sleep mode or suspend mode before it was woken up; the keyboard still works, either way.

Your USB speeker doesn’t wake anything up. If your computer is in sleep mode so are your usb devices. If your computer is in suspend mode, generally, so are your usb devices.

You can tap a keyboard button, and that sends a signal to wake up – you can tap your speaker as much as you like, but that will never happen; and your Speaker has no signal to send by itself.

The best thing to do is not let your computer sleep. Just let the screen blank, instead; and possibly fall to suspend mode; but not sleep.

Do some more thinking. :slightly_smiling_face:

@Mirdarthos has already suggested one method to try; but that still doesn’t involve sleep.

A brief explanation of Sleep and Suspend:

Sleep (aka Hibernation) and Suspend (aka Standby) are both two separate Power Saving states.

With Hibernation (Sleep), your work is saved to a hibernation file and the computer switches off: If set correctly in BIOS, it can be woken (read: switched on) again by moving the mouse, or touching a keyboard button.

With Standby (Suspend), your work is saved to memory. Leaving the Standby (Suspend) state is faster than leaving the Hibernation (Sleep) state. If Standby (Suspend) is in effect for an extended period, then the computer state switches to Hibernation (Sleep) mode.

These modes can be regulated usually by changing the duration of each state in whatever Power Settings are available in your OS.

Another explanation:

Imagine your computer is like a bear.

  1. Hibernation: When a bear hibernates, it’s like your computer going to sleep. It’s still alive, but it’s in a deep, deep sleep. It saves energy and doesn’t do anything until it wakes up. Your computer does this too. When you’re not using it for a while, it goes to sleep, and the screen turns off. It’s still there, but it’s resting to save power.

  2. Standby: Standby is a bit different. It’s like when you pause a video game or a movie. Your computer is ready to go back to work quickly when you want it to. So, when it’s in standby, it’s not fully asleep like hibernation. It’s more like it’s taking a little nap, and when you touch the mouse or press a button, it wakes up right away, just like when you unpause a game.

So, hibernation is a deep sleep to save energy, and standby is like a quick nap, so your computer can wake up fast when you need it.

:teddy_bear:

If a computer is in a sleep state it would not be able to play music to USB speakers, because the music player goes to sleep and software audio server (PulseAudio/PipeWire) goes to sleep

One of the first configuration changes I make on a new Linux install is to disable system sleep and only allow the monitor display to turn off. And also add user account to the audio group so that audio playback is not stopped when the screen is locked or user is logged out

(:musical_note: King Crimson - Sleepless - YouTube :guitar: )

1 Like

Right that makes sense. I found this article which covers how to disable suspend:

I made a little script to do this for me:

https://github.com/bit-shift-io/scripts/blob/master/disable_suspend.sh

I’ll see if this resolves my issues!
Thanks guys.