2

I have a speaker (Bose SoundLink Mini) connected to my MacBook Pro, and it switches off after periods of non-use. This means that it will shut off even while I am at the computer, if a sound hasn't been played in awhile. What is the most sensible way to have a very quiet (ideally inaudible) sound played every fifteen minutes? I have a little familiarity with AppleScript and am happy to learn more; I don't yet know anything about other scripting methods.

5
  • Create an applescript or perhaps try chron ? Two possibilities you can check. Commented Apr 13, 2020 at 9:26
  • /usr/bin/afplay might help. What's your level of expertise regarding shell scripts, AppleScript, launchd/cron? Commented Apr 13, 2020 at 9:27
  • Thanks! My level of expertise is minimal with AppleScript, and none with shell scripts and cron. (On the other hand, I like to learn.) Commented Apr 13, 2020 at 9:41
  • Please add your own solutions as one answer below, this makes it easier to find them in the future. Commented Apr 14, 2020 at 14:04
  • Done (I think)! Commented Apr 15, 2020 at 15:06

2 Answers 2

1

Simply create a launch agent which repeatedly says something (or plays a sound) and load it:

  1. Create a plist with nano in Terminal:

    nano ~/Library/LaunchAgent/usr.home.bose.wakeup.plist
    
  2. Copy the following lines and paste it into the Terminal window:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Disabled</key>
        <false/>
        <key>Label</key>
        <string>usr.home.bose.wakeup</string>
        <key>ProgramArguments</key>
        <array>
            <string>/usr/bin/say</string>
            <string>wake</string>
            <string>up</string>
            <string>you</string>
            <string>lazy</string>
            <string>Bose</string>
            <string>SoundLink</string>
            <string>Mini</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>StartInterval</key>
        <integer>887</integer>
    </dict>
    </plist>
    
  3. Save the file with ctrlO and exit nano with ctrlX

  4. Load the plist with:

    launchctl load ~/Library/LaunchAgent/usr.home.bose.wakeup.plist
    

You can use other voices by adding the option -v $VOICE. To get the list of all available voices enter say -v ? in Terminal.

Example:

...
<array>
    <string>/usr/bin/say</string>
    <string>-v</string>
    <string>Agnes</string>
    <string>wake</string>
...

The downside of say: you can't set a sound level!

Therefore an alternative launch agent with afplay instead (you can set the sound level with the -v option):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Disabled</key>
    <false/>
    <key>Label</key>
    <string>usr.home.bose.wakeup</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/afplay</string>
        <string>-v</string>
        <string>0.05</string>
        <string>/System/Library/Sounds/Submarine.aiff</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>StartInterval</key>
    <integer>887</integer>
</dict>
</plist>
3
  • So the entire say part of your answer is not an answer to the question? Should it be two separate answers, or re-ordered so the useful answer is more prominent? Commented Apr 13, 2020 at 11:47
  • @theonlygusti The say part answers the question "What is the best way to occasionally play a sound?" but doesn't meet one contraint: to [be] very quiet (ideally inaudible). I rather wanted to show how to use a launch agent to repeatedly play a sound. Commented Apr 13, 2020 at 11:59
  • 1
    Thank you! Yes, I'm sure I could record something more quiet, or perhaps even a recording of silence would work. Commented Apr 14, 2020 at 11:13
1

For this specific speaker, it turns out there is an easier answer: just press and hold the bluetooth and + buttons until it verifies that auto-off has been disabled. Still, thank you all for the input!

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.