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.
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 repeaton 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.
UPDATE: In Snow Leopard I have had to modify this script to get all of its components to work and don’t at the moment have time to write a new posting describing the changes.
“Studying for my orals” my ass.
;)
Hey! One has to take little sanity breaks and it happens that a little bit of old techie fun (which actually makes something useful too!) is a good way for me to relax.
Wow cool! Um, but you’ll have to buy me a MAC before I can try it out –.
Sweet little gadget. God job putting the items together like that! :D
Your alarm is amazing. I had set up one myself almost exactly like it except for the incorporation of applescript. I have been looking for a way to get World News Now to play automatically every morning and your script works great. Thanks for some great code.
The best alarm I’ve found. I’ve been looking for alarms for ever, and I built my own (sans applescript) which worked nowhere near as well as yours does. Easy to work with and expand to add new functions! Well done.
Wow, I searched for “play npr as alarm on mac os x” and got this amazing post, which does exactly what I wanted and far more! I will install now and tell you what I think! Thanks for posting.
I hope it works for you!
I tried to type it in manually- so I could learn all about the Automator and other fun stuff, and for some reason my iCal wasn’t triggering the script. Yours worked fine, though, when I copied and pasted that in. Some little things
– the smart list for NPR feed, you should add that to your list here in the post
– A bit confused about iCal’s settings for the alarm file vs. the event file – so odd why there’s 2 names.
– the pdf doesn’t have the static values tick and the other value on it- but I got that copied in from your post & the download
– some other little applescript issues on the PDF, which I think are just issues with the full display. DOwnloading your script solves all fo that.
– weird that iTunes doesn’t have an automator command for finding the end of a tract. A friend told me there is one, but I didn’t see it in the library.
This is so neat. THis is what gets me excited about the mac, I have to say.
thanks again! I’ll add your dialogue box bit tomorrow.
Anna, thanks for your comments and pointing out some weaknesses in my descriptions. I think this alarm would be ideal if I added a feature which jumped automatically to the beginning of the news and passed the advertisement at the beginning and the small one at the end.
Ah, we can dream! Get me crackin’ on this. I’m going to run through another “old alarm” tonight and then tomorrow I’ll work on the “new alarm” with dialogue! I setup ramping wake up times throughout the week- I’m really excited about this! Before this alarm I had KPFA (a liberal San Francisco news station) emitting loud static in my hear for an hour. Big step up. Blogging about this now. I guess you’ll see the trackback :0
It is appropriate time to make some plans for the future and it’s time to be happy. I’ve read this post and if I could I desire to suggest you few interesting things or advice. Maybe you can write next articles referring to this article. I want to read more things about it!