Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

-aggie-

macrumors P6
Original poster
Jun 19, 2009
16,793
51
Where bunnies are welcome.
Does anyone know how to use other sounds other than a beep in a Bash shell script in UNIX?

I have this:

echo -e '\a'

But that only make a boring beep noise. I'd like to be able to use any sound file.
 
Paste this into a Terminal window:
Code:
say -v Princess "I'm not boring you, am I?"

It's not "any sound file", but it may be useful.


For sound files, there's the afplay command. Enter:
Code:
afplay -h
to print its builtin help, which is all there is unless you read its source. The source for afplay and its relatives is installed with Xcode 3.1.

There's also afinfo and afconvert. Again, no man pages of any consequence, so afinfo -h and afconvert -h.


There's also "Play Sound.app":
http://microcosmsoftware.com/playsound/

It's scriptable, so you can use the osascript command to tell it files to play, and how to play them.
 
say and afplay were exactly what I needed. Thanks.

I've taken a battery script and made it my own to tell me when my battery is below a certain charge on my MBP when I'm not running on the charger. I do that like once a week to keep my battery healthy, and sometimes I forget and it goes dead, which I don't want. So, say will be helpful for just saying the battery is running low. Afplay was able to play all the other sound files I have. Again, thanks.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.