setting the sound volume

For some reason I cannot seem to figure out the specific command and parameters to set the volume level on my Mac. I just want to do this with a script so I can be sure that it always sets to my pref on startup. My sons have a tendency to reset it. Does anyone know what the command for this is?



The following uses the set volume command from the “Standard Additions” osaxen.

tell application "Finder"
	set volume number -- the volume level, from 0 (silent) to 7 (full volume)
end tell

It works great for me on OS 8.6
Good luck with your sons. :smiley:

Thanks Paul. This works for the alert volume - although it will not supercede what I have set in the control panel. But is does not affect the main system volume. Perhaps it is the difference between 8.6 and 9.2.2.

Oh well, guess I’ll just have to keep digging until I find it.


Which means that the Finder isn’t needed. :wink:


tell application "Finder"
	set volume number -- the volume level, from 0 (silent) to 7 (full volume)
end tell

Can be changed to this:

set volume number


I’ve found that in OS X the “set volume n” command only works on the system - not the alert volume. This is very annoying because I want to make a program to chime every 15 seconds, but I normally have my alert volume turned to 0. I want to be able to override that only for this script!!! Also, I would like to be able to specify which sound I want to play for the alert. I can’t find anything on how to do this either. Any help would be appreciated!

To play specific sounds, I reckon you’ll need to pick up a utility or osax that provides this feature. I reckon a search of would turn up something useful. It’s possible that whatever allows you to play the sound will also offer volume control. :slight_smile:

Thanks, I didn’t know about the ability to search for these. However, it seems that they are mostly pretty old. The most recently updated is Johns Commands (2000), and that was reported here to be broke with 10.2.4 - so it doesn’t look like there is anything that would work…

Nuts, I apologize! Even though you mentioned OS X, I based my answer on the forum and not the question. :oops:

One of the many cool features of Extra Suites is the ability to play System 7 sounds and AIFF files (OS X’s sound format). Extra Suites is a background scripting application which contains over 70 commands for AppleScripters using OS X. :slight_smile:

Turns out Apple Script Studio Actually does support the ability to play AIFF sound files. I finally found the documentation on this:

Thanks for sharing the link. I imagine that since AppleScript Studio can hook into Cocoa, it can do a lot of things that plain ol’ AppleScript can’t do. :slight_smile:

And here is another application that one can use with applescript to play sounds.