Any ideas for an AppleScript that'll play a sound to keep my speakers awake?

I have a pair of Harman Kardon SoundSticks which are brilliant with one big problem: by design, after a period of inactivity they go to sleep. They'll come back on when there's sound from my Mac Mini (or MacBook Pro), but there's a gap of a couple of seconds so any sort of notification sound has been and gone by then, I often miss the first few seconds of songs or Zoom calls, and so on.


What I'd love is for an AppleScript (or similar) to somehow play a short sound every ten minutes to keep my speakers awake. The dream is to also find some sort of low frequency sound that I don't actually hear, but I expect that'll take some trial and error.


I've found a similar solution for PCs, and an old solution for Macs, but nothing that's doing the job in 2020.


Any advice would be much appreciated!

Mac mini 2018 or later

Posted on Oct 28, 2020 3:38 AM

Reply
Question marked as ⚠️ Top-ranking reply

Posted on Oct 28, 2020 11:58 AM

It's trivial to write a script to play a sound every 10 minutes:


on idle
	beep
	return 10 * minutes
end


Save that in a Script Editor document with the 'Stay Open' option selected.

Now every 10 minutes it will play the standard system beep (the 'return' value tells it when to run again)


If you want to play any arbitrary sound, you can invoke afplay with the path to the sound file


on idle
	set soundFile to "/path/to/some.aiff"
	do shell script "/usr/bin/afplay " & soundFile
	return 10 * minutes
end idle


You'll need to provide the full path to the sound file to play. You can even record a sound file or movie full of silence, which should be enough to trigger the SoundSticks (if you provide a path to a movie file it will play the audio track).

6 replies
Sort By: 
Question marked as ⚠️ Top-ranking reply

Oct 28, 2020 11:58 AM in response to PRPRPRPR

It's trivial to write a script to play a sound every 10 minutes:


on idle
	beep
	return 10 * minutes
end


Save that in a Script Editor document with the 'Stay Open' option selected.

Now every 10 minutes it will play the standard system beep (the 'return' value tells it when to run again)


If you want to play any arbitrary sound, you can invoke afplay with the path to the sound file


on idle
	set soundFile to "/path/to/some.aiff"
	do shell script "/usr/bin/afplay " & soundFile
	return 10 * minutes
end idle


You'll need to provide the full path to the sound file to play. You can even record a sound file or movie full of silence, which should be enough to trigger the SoundSticks (if you provide a path to a movie file it will play the audio track).

Reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Any ideas for an AppleScript that'll play a sound to keep my speakers awake?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.