February 27, 2006
Westminster Chimes on OsX…
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:
- 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).
- 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.
- Download and install the very small scriptable application “PlaySound” for quick and easy sound playing via applescript.
- 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.
- 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)
set cdate to ((((time of (current date)) / 60) / 60) as integer)
if cdate is less than 12 then
set chimenum to (cdate - 1)
set chimenum to (cdate - 13)
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
- 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"
15 * * * * /usr/bin/open "/Users/a11en/Apple scripts/SoundScripts-Westminster/15 glass.app"
- 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.
- 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:
- 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.
- 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…