February 27, 2006

Westminster Chimes on OsX…

Posted in Lifehacks, Mac at 6:43 am by a11en

Ok, I have to make this quick, as time’s a wastin’! πŸ™‚ But, here’s a minitutorial for getting chimes to work on os X. My approach is somewhat simple: Why use an extra program when the system should be capable of this? But, in the end, I actually did use an extra program. πŸ˜‰ he he. Oh well, it works! It’s free! It’s very configurable! all good things…

Here are the steps:

  1. Choose a chime setup that you like. Popular ones include Westminster Chimes and Ship’s Bells (Naval Bell chimes used for the watch changes on Navy Ships).
  2. Find a source for soundfiles which will be your actual “chimes”. I found my Westminster ones at this link [thanks Rita!]. Also found ship’s bells at this link.
  3. Download and install the very small scriptable application “PlaySound” for quick and easy sound playing via applescript.
  4. Make a folder in your home directory where you will keep everything (and not move it)… the sounds and applescripts should go here so that you can find them easily.
  5. You want to make up little applescripts saved as “applications without startup windows” for your Cron job to run. Here are two examples. One is for the various minutes i.e., 15 shown here, and one is for the “on the hour” shown below it. Note that the files to play are given to the application as aliases. You can obtain the hfs path through contextual menu additions similar to “PathSnagger“. Also these scripts are quick and dirty, but they work. πŸ™‚ I’m positive there’s someone out there who could do the same in Perl or the like in less than 20 characters. πŸ˜‰ I could care less, as these work for me. note: there are 2 scripts shown below as examples… you’ll need to make your own with your own files as well as extras if you want the half-hour and the 45 min. sound to play.

    tell application "Play Sound"
    play ("Macintosh HD:Users:a11en:Apple scripts:SoundScripts-Westminster:Westminster Glass 15.wav" as alias)
    end tell

    set cdate to ((((time of (current date)) / 60) / 60) as integer)
    if cdate is less than 12 then
    set chimenum to (cdate - 1)
    else
    set chimenum to (cdate - 13)
    end if
    tell application "Play Sound"
    play ("Macintosh HD:Users:a11en:Apple scripts:SoundScripts-Westminster:Westminster Glass 00.wav" as alias)
    play ("Macintosh HD:Users:a11en:Apple scripts:SoundScripts-Westminster:Westminster Glass Toll.wav" as alias) repeat chimenum
    end tell
  6. Set up Cron to launch these scripts when appropriate. For this, I highly suggest Cronnix, which is a GUI for the system’s Cron application which is already on your mac. To set this up, I have a line similar to the following in Cronnix:

    0 * * * * /usr/bin/open "/Users/a11en/Apple scripts/SoundsScripts-Westminster/Hour Toll Glass.app"
    and
    15 * * * * /usr/bin/open "/Users/a11en/Apple scripts/SoundScripts-Westminster/15 glass.app"

  7. Hit “test now” before you save, to ensure that cron launches your file and plays properly. The chimes should work as you hoped them to as long as you saved the applescripts as little applications, and the aliases to your files are correct.
  8. If the test worked, feel free to save the cron file, and you can quit Cronnix. Watch the clock and see if the scripts launch at the right times.

This approach is also tailorable. If you read up on Cron, you can make the sounds work only during specific hours (saves your spouse’s wrath when the chimes go off in the other room at 3am. You can alter the volumes in PlaySound so the chimes are always at the same volume, and you can also make more complex scripts and Cron jobs for more complex Chiming situations- i.e., Ship’s bells (something I haven’t done yet). Future work I’ll be thinking about is a simple way to turn off the chimes when desired, but for now, the mute button will work nicely. BTW, one of the reasons I like this approach is how tailorable it is. If you only like the 15 minute chimes, or want them to all be the same sound file (like your dog’s bark), you can do that. In fact, you can have the system wake you up every business day with a complex chime such as the Zen Alarm clock mentioned below (my next little project to take my mind off the horrors of my worklife). Yes, you can do this with a little application, but why? You have everything you need in your system. [I suspect there’s a way for the system itself to play the sounds, but for now I’m happy with such a low-memory footprint application I can use elsewhere to play sounds without launching iTunes or Quicktime player.] Finally, Kudos go to Merlin Mann and the guys on the forums who got me thinking about this. It helps me watch my time slipping away and keeps me a bit on task. [When not writing stuff like this to help others do the same.]

Slight issues you may or may not like:

  1. I find that while I’m working the system runs the script applications, so for a moment, I lose focus on the document, which resolves itself immediately after the script launching. It’s a slight blip in the screen as the script is run. There may be a way to run the script in the background- I’m working on that.
  2. There isn’t a “one-click” way to turn this off, other than the mute button. You can however, turn it off by deselecting the checkmark boxes in Cronnix, and saving the changes.

Earworm: “Don’t Take Your Love From Me” performed by John Coltrane from the album The Stardust Session

Brainworm: Prelim Document- views of Crystal Boundary, issues with extrinsic defects at the GB, writing updated versions, and thin-film growth in the vacuum chamber this evening…

Funworm: FountainPens… Lamy’s Safari’s and Pelican 150’s… make grading so much more fun…

Advertisements

3 Comments »

  1. […] For a bit of a review of the methods I’ve used for the Westminster Chimes on OsX, please read my previous post on the topic: Westminster Chimes […]

  2. Thanks for another excellent post. Where else may just anyone get that kind of info
    in such a perfect way of writing? I’ve a presentation subsequent week, and I’m on the search for
    such information.

  3. divorce said,

    Have you ever thought about writing an ebook or guest authoring
    on other blogs? I have a blog based on the same information you discuss and would really like to
    have you share some stories/information. I know my subscribers
    would appreciate your work. If you’re even remotely interested, feel free to send me an e-mail.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: