LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-11-2022, 12:28 AM   #1
slac-in-the-box
Member
 
Registered: Mar 2010
Location: oregon
Distribution: slackware64-15.0 / slarm64-current
Posts: 634

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
program to prevent standby mode on speakers that can't disable it themselves


Howdy LQ:

Yep, I bought some speakers, and they don't do what I want: wake me up. I frequently use my linux laptop as an alarm clock, with a simple command like
Code:
sleep 300m && ffplay alarm.flac
I change my alarm.flac to different songs I feel like waking up to. The problem is my laptop speakers are not always loud enough to wake me up.

So I bought something that looked good in the picture: The Marshall Action II. I didn't need rechargeable or portable; just something that plugged in, and can use an aux cord. These speakers do both, as well as bluetooth. But by the time 300 minutes have elapsed, the speakers go into standby mode, and don't play my alarm. In fact, I think it only takes ten minutes or so, and the only way to wake the speakers up, is to touch them: manually turning the volume knob. So needless to say, I am disappointed. I found out that Marshall provides no way to disable this feature, and apprently it was created to "save power" in the EU.

Thus, I've been contemplating a program that can do the following:

Every nine minutes (so a cron job is in order), check and see if sound is already going to the speaker, and if not, send a sound that the speaker detects but not my ears.

So the cron part is easy, and the playing some low frequency sound shouldn't be too difficult. But what would be the most efficient way to check for output sound? I thought about searching for processes of what I play sounds with the most, such as ffplay, moc, ogg, etc., but there are just too many options, so I figure there must be something lower level.

Like if I were to open pamixer, and check output, I see the green bar moving when there is activity. Is there a command-line equivalent that would return "zero" for no output, and some number for whatever it was at when the command was executed?

Just asking this question made me check in /proc, and I just discovered that this returns "closed" when there's no sound, but it is dependent on knowing which sound card is in use:

Code:
cat /proc/asound/card1/pcm0p/sub0/status
Haha... that will work, but now I want to post this anyways
 
Old 10-11-2022, 12:51 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 5,973
Blog Entries: 23

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
Sometimes just formulating the question for others can lead to a solution, as it apparently did here!

Glad you figured it out and thanks for sharing the experience with the rest of us! It never occurred to me that speakers might have a "screensaver" mode, or powersaver in this case. How annoying...

Last edited by astrogeek; 10-11-2022 at 12:55 PM.
 
Old 10-12-2022, 12:22 PM   #3
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Older: Coherent, MacOS, Red Hat, Big Iron IXs: AIX, Solaris, Tru64
Posts: 2,688

Rep: Reputation: 530Reputation: 530Reputation: 530Reputation: 530Reputation: 530Reputation: 530
Quote:
Originally Posted by astrogeek View Post
Sometimes just formulating the question for others can lead to a solution, as it apparently did here!
Heh! I can't remember how many times that doing a sanity check on a question before posting it resulted in an AHA! moment.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
plugging in headphones or speakers doesn't disable my laptop's built in speakers moljac024 Linux - Software 14 07-13-2017 09:01 AM
disable sleep mode, away mode standby, etc. ZiGz Linux - General 4 06-19-2016 02:15 PM
How can i prevent the gnome task bar icons from rearranging themselves when i reboot? Stevithen Debian 1 04-10-2010 06:10 PM
Printers disable by themselves OOsorio Linux - Newbie 4 05-16-2008 07:16 AM
disable standby mode? wimva Linux - Newbie 7 09-23-2003 10:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration