Incremental volume hotkeys for OS X

Update: As of OS X 10.7.4 the original shortcut has been restored! Woohoo! FYI, it's Option + Shift + Vol Up/Down in most setups.

In previous versions of OS X you could change the volume with a keyboard shortcut in smaller increments[1]. When you have a good set of monitors[2] you'll often find that each standard increment is either too soft or too loud. This script allows you to get that Goldilocks zone back again.

TL;DR: I have a GitHub repo setup for this.

What you'll need:

  • OS X Lion (10.7) [this feature is built-in on previous OSes]
  • AppleScript Editor [built-in to OS X] - the result will be compiled
  • Alfred (or equivalent Global Hotkey for script mapping tool)

You can either copy and paste the scripts below and create the "Up" counterpart, or just download them here.

Incremental Volume

1
2
set currentVolume to output volume of (get volume settings)
set volume output volume (currentVolume - 2)

You can also play the "click" sound that normally plays upon volume change:

1
do shell script "afplay /System/Library/LoginPlugins/BezelServices.loginPlugin/Contents/Resources/volume.aiff > /dev/null 2>&1 &"</pre>

(Optional) Growl Integration

If you have Growl installed you can get notifications when you execute the script.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
tell application "System Events"
	set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
end tell

if isRunning then
 set message to "Dropped the volume by 2 notches. Current volume is " & currentVolume - 2 & "%"
 
 tell application id "com.Growl.GrowlHelperApp"
 -- Make a list of all the notification types 
 -- that this script will ever send:
 set the allNotificationsList to {"Volume Down"}
 
 set the enabledNotificationsList to ¬
 {"Volume Down"}
 
 register as application ¬
 "Incremental Volume Shortcut - Down" all notifications allNotificationsList ¬
 default notifications enabledNotificationsList ¬
 
 notify with name ¬
 "Volume Down" title ¬
 "Volume Down" description ¬
 message application name "Incremental Volume Shortcut - Down"
 
 end tell
end if

Hit Compile and Save it somewhere handy.

Setting up the Keyboard Shortcut

If you have Alfred installed (you may need their plugin pack?) you can assign a global keyboard shortcut to run an AppleScript (or just about any other script really!).

  1. Open Alfred (by default it's Command + Space)
  2. Click on the cog in the top right to open the apps' preferences
  3. Open the Hotkeys pane
  4. Drag and drop the script file from Finder
  5. Pick a keyboard shortcut, I used Opt + Shift + Cursor Up/Down

References

  1. For the Growl integration: http://stackoverflow.com/questions/1449543/implementing-keyboard-volume-control-buttons-in-applescript-setting-volume-ins
  2. AppleScript to Growl integration: http://growl.info/documentation/applescript-support.php
  3. AppleScript Reference: https://developer.apple.com/library/mac/#documentation/applescript/conceptual/applescriptlangguide/

Annotations

  1. For the record, this keyboard shortcut (which still works in Snow Leopard) is Opt+Shift+F11/F12.
  2. As in, studio monitors, high-quality headphones or stereo speakers where a small change in sound output from the source could make a significant change in the perceived sound. Gotta be careful with your ears, you only get one set of them!