I created a new (Macintosh) computer automated alarm to get me up and about in the morning. Here is what the alarm does:

1. My computer wakes itself up in the morning. At the appropriate time it opens up iTunes and turns the volume all the way down.
2. It randomly chooses one song from a playlist containing very soft and soothing wake up music. While this is happening it downloads the most recent 7 AM summary of the news from NPR.
3. iTunes starts to play the soft song and over the next 30 seconds or so it slowly turns the volume up to full.
4. After the song is finished playing iTunes then plays the 5 minute summary of NPR news for this morning.
5. After the news is finished, it randomly chooses one song from a playlist containing much louder and more lively wake up music which it plays at full volume.
6. The computer then extends a large metal arm and proceeds to beat me really hard with a pillow until I get out of bed. (Ok, maybe I’m still working on this feature).

In case you want to create something similar, read on.

Workflow Overview

Here is what you need to make the same thing:

1. A Macintosh with OS X Tiger
2. iTunes
3. 2 Playlists (one with a list of soft wake up songs, and one with a list of hard wake up songs)
4. 2 Smart Playlists (one which randomly chooses a soft wake up song, the other which randomly chooses a hard wake up song)
5. You need to set up an “Automator” workflow. You can download mine (which you can modify to your own needs) here: Alarm.app. After decompressing the zip file, just drop this on Automator to open and edit it.

Here is a pdf of what the Automator workflow looks like and the 12 steps described below:

1. Launch iTunes
2. Run an applescript updating my podcasts:

tell application “iTunes”
   updateAllPodcasts
end tell

3. Set iTunes Volume to the lowest setting
4. Get Specified iTunes Items: Random Alarm (the soft smart playlist)
5. Play iTunes Playlist
6. Run an Applescript slowly turning up the volume:

property tick : 5 — raise volume level by this many each loop
property thismany : 2 — seconds to wait before making next increment to volume
tell application “iTunes”
set snd to 100 — want to eventually go up to full 100% volume
set sound volume to 0
repeat
if (get sound volume) is greater than or equal to (snd - tick) then
set sound volume to snd
exit repeat
end if
set sound volume to (sound volume + tick)
delay thismany
end repeat
end tell

7. Run an Applescript which waits for iTunes to get done playing:

repeat
if (isiTunesDone()) then — Wait for iTunes to stop playing
exit repeat
end if
delay 5 –Wait 5 seconds and try again
end repeat

on isiTunesDone()
–modified from http://plasticbugs.com/index.php?p=267
set iTunesDone to false
tell application “iTunes”
if the player state is playing then
set iTunesDone to false
else
set iTunesDone to true
end if
end tell
return (iTunesDone)
end isiTunesDone

8. Get Specified iTunes Items (the smart playlist choosing the NPR 7:00 podcast for today)
9. Play iTunes Playlist
10. Run the above applescript waiting for iTunes to get done again.
11. Get Specified iTunes Items (the smart playlist choosing a random “hard” and loud wake up song). It should already be at full volume after the script in step 6.
12. Play iTunes Playlist

It is probably easiest to download the workflow itself above and then edit it.

Once you have the workflow and have set up the smart playlists in iTunes, then all you need to do to get this into a functioning alarm is:

1. Tell the computer to wake up in the morning some time (System Preferences: Energy Saver: Schedule: Set the wake up time). This way you can put the computer to sleep when you go to bed but makes sure it is awake in the morning.

2. Set up an iCal calendar event (or a regular event if you get up the same time certain days of the week) which has its “Alarm” set to “Open File” and open the Alarm.app workflow.