Wake Up with Music
The shrill buzzing of an alarm clock is an unpleasant way to wake up. Much better to wake up with music, and even better if the music starts quietly and slowly builds to a normal volume.
This simple Applescript plays music with iTunes, starting very quietly and gradually getting louder. It's easy to run using an iCal alarm. There's some variables at the top of the script to control how fast the music increases in volume, how loud it will get and which iTunes playlist to choose. Copy the code, paste it into AppleScript Editor, and run it to see how it works. I found the original script somewhere on the internet, added the error handling and made some minor changes. Since the original author shared it freely, so will I.
property systemVolume : 70 -- general volume level for OS X property iTunesVolume : 80 -- final volume for iTunes property rampTime : 100 -- how many seconds it takes for volume to go from 0 to final volume property PlaylistName : "Good Music" -- name of the playlist -- CHANGE THIS
set volume output volume systemVolume
tell application "iTunes" try launch activate
set sound volume to 0 -- 0 = no volume, 100 = full volume set shuffle of playlist PlaylistName to true play playlist PlaylistName set view of front window to playlist PlaylistName repeat with counter from 1 to rampTime delay 1 set sound volume to iTunesVolume * counter / rampTime end repeat
on error number errorNumber -- if something goes wrong with iTunes, play a music file using the command line shell as a backup if errorNumber is not -128 then -- -128 is "user cancelled" do shell script "afplay '/Users/username/Music/iTunes/iTunes Music/Great Song.mp3'" -- CHANGE THIS
display dialog "error " & errorNumber buttons "OK" end if
set sound volume to iTunesVolume end try end tell