Using your computer as your alarm clock

What does every teen do? Go to school. And what does every teen use to wake up? Either a radio alarm that plays anything you want as long as its static, or a loud, obnoxious BUZZ BUZZ BUZZ until you throw it out the window. How can you save money on broken alarm clocks which can add up after a while? Use your computer to play your favorite song at the time you need to wake up. Who would have thought of that? You’ve got a computer in your room that is turned on 24/7, so it’s available, and you’ve also got an alarm that is on 24/7 that is annoying. Throw the alarm out the window once and for all and use your computer.

I’ve split this guide into two portions. The first is for all of you Windows users out there, and the second part is for all of you Linux users out there.

Windows

Windows is quite simple to get set up as a fully working alarm clock. All you need is your favorite music playing software. I prefer to use WinAmp because it’s small, and has a few other options that you can use (streaming to other computers to wake up the whole house for instance :D ), but you can use others, such as iTunes. Next, you need a playlist file, which we will use a .M3U file, which is basically just a list of songs, but it also plays with iTunes (I have not tested it with Windows Media Player). This file is just a simple text file that lists the songs you want played (everything must be in the same “folder” for this to work without jumping through too many hoops). Finally, you need your volume up. Not loud enough that it wakes up the people three doors down (no pun intended) from you, but lound enough to get you awake and into your usual routine.

Step 1:
Collect your music. It doesn’t matter where you get it from, as long as whatever music player your using can play it (as a rule of thumb, just stick with MP3s).

Step 2:
Build your .M3U playlist file. Using “Notepad” (under “Accessories” in the start menu), it creates a pure text file without any formatting that Microsoft Word or Wordpad will put in it.

Here’s the look of the .M3U file:

#EXTM3U
song1.mp3
song2.mp3
song3.mp3
and so on.mp3

Just save this as “alarm.m3u” to wherever your music is saved.

Step 3:
Create a “batch” file that will start your playlist. A batch file is simple in this respect. Run a single command that opens and starts playing your playlist automatically. Save this as “alarm.bat” in the same place as your playlist file.

Here’s what your batch file should look like:

start alarm.m3u

And that’s it for the file portion of the alarm clock.

Step 4:
Create a “Scheduled Task” to start the batch file at the desired time. Under the “Control Panel”, there is an “applet” called “Scheduled Tasks.” Create a new task, and where it asks for the program to run “Browse” to the “alarm.bat” file that we created earlier. Set the time, and you have yourself a custom alarm clock.

Note:
If you set your music player to shuffle, it won’t start with the same song every morning.

Linux

The Linux part of this guide will focus on using Ubuntu Linux (7.10 Gutsy Gibbon) using Rhythmbox as the media player.

Step 1:
In rhythm box, drag and drop your selected music in, and that takes care of the playlist portion of the alarm.

Step 2:
Set up two (2) “cron” jobs. Cron is a program that runs in the background that checks once a minute to see if any events need to be executed. The first one opens Rhythmbox and the second one actually plays the music. If you try to do them at the same time, it won’t work because it will try to play before the player is finished opening. So, during the scheduling portion, set the open event before the play one and you won’t run into any issues.

Here’s what the two Cron events look like:
1:
export DISPLAY=:0 && rhythmbox-client
2:
export DISPLAY=:0 && rhythmbox-client –play

To set these up, start up “Kcron” found under “Applications” -> “System Tools”. Create and schedule the events in that order, and you now have a working alarm clock that runs Linux.

I hope this helps you in your quest for a more alarming alarm clock. If you have questions, just post them here.

3 Responses to “Using your computer as your alarm clock”

  1. Mårtern says:

    In GNU/Linux, I’ve learned just the other day, that there is a really simple method instead of messing with cron and various plugins to music players thats locks up when you most need them.
    Hit the command line whit following code:

    sleep 8h && mplayer /home/*Your_User_Account*/Slipknot_Wait_and_bleed.mp3

    sleep –help for more options
    nifty ha :-)

  2. Aaron Liske says:

    true, that would work, but it doesn’t look like it creates a recurring event, and it starts the same song every day. That’s what I try to avoid by using a media player in Shuffle mode. Thanks for the suggestion though, and I probably will use the sleep function later on.

  3. Bob says:

    Excellent – a perfectly elegant solution for a problem I couldn’t get my brain around (as in ‘Why didn’t *I* think of that??’). For Windows users, here’s another way to schedule the task, which makes it easier to do the same thing on multiple days. Using the example play list and batch file above, go to a Command Prompt (Start -> Run -> cmd ), and type:

    at 6:10 /every:m,t,w,th,f c:\songs\alarm.bat

    This will create an event that runs alarm.bat (change the path/folder for your situation) at 6:10 AM every Monday thru Friday (you can add sa and su if you need Saturday and Sunday). For WinAmp at least, it will start up and begin playing (I like mine on Shuffle) at 6:10 each morning.

    Nice Work!

Leave a Reply