πŸ”” Most Elegant Way to Make Keyboard Maestro Chime on the Hour?

Hi Team

I find it really useful to know when the hour starts - I loved it on the Apple Watch, is there any way to chime on the hour with the Mac?

Note that it's not a chime every 60 minutes. It's a chime on the hour (i.e. when the clock strikes 10:00, 11:00, etc.)

Many thanks for your help with this!!

Cron trigger. Action that plays a ding sound.

6 Likes

If you don't like (or like me, understand :sweat_smile:) the chron trigger, you could also use the periodic trigger and start it on the hour (set it to run from 00:00 to 00:00).

1 Like

I’m with @vincent_ardern on this. The KM wiki page about the cron trigger even gives the setting you need use for an hourly, on the hour trigger which is @hourly

See the wiki here: trigger:Cron [Keyboard Maestro Wiki]

3 Likes

You used to be able to set this in Preferences. Unfortunately you can only "announce" the time these days, not chime, but if you'd like to be told the time on the hour then System Preferences->Dock & Menu bar->Clock and tick "Announce the time". (Or that's System Prefs->Date & Time->Clock on older OSs).

1 Like

Hi @cdthomer. Once you understand cron, you'll love it. In addition to the KM trigger, you can use Terminal to configure cron for other purposes.

This YouTube video does a nice job summarizing the configuration: How to write Cron expression

2 Likes

The Periodic Trigger still works.

1 Like

Hey Jim, thanks for the link! I'll check it out this weekend. I know the basics only so no doubt i'll pick up some good info from it.

1 Like

Is there a difference in resource utilisation between the two triggers? I want to keep it as light as possible

1 Like

Hi @NoorTheGrey. I suspect not, but a good question for @peternlewis.

I doubt there is any appreciable difference between the two.

I would use the Cron trigger as it is explicitly specifying the time, as opposed to the periodic trigger which is more implicit.

Now we just need a fine old-fashioned clock chime! :mantelpiece_clock: Any suggestions for a clean and freely available sound file? :loud_sound:

Google "Westminster Chimes"; there are free mp3 files available around the web. Whether you want to hear all that every hour is another matter.

1 Like

Here’s a step-by-step guide ↓

1 Like

Many thanks for this @peternlewis!! It works - is there any way of making the sound play at a volume that's a function of the current system settings? (e.g. I want this chime to sound about 50% of what I have the speakers at that point)

Not with this action no. Maybe by some other means, maybe with AppleScript for example, I don't know of any obvious ways.

Unfortunately, AppleScript can't natively play sounds (AFAIK). But macOS ships with afplay, whose man page is useless but which shows its options with afplay -h.

A quick test shows that to halve the volume you need to 1/10th the value given (where 0 is silent and 1 is 100% of current system volume) -- which I assume is a "decibels are logarithmic" thing, ie

afplay -v 0.1 /System/Library/Sounds/Glass.aiff 

...sounds to me like half

afplay -v 1 /System/Library/Sounds/Glass.aiff 

...at the same system volume setting.

So something like
play sound
...substituting in the path to your "chime" file, could be enough.

Footnote – the osascript standard additions display notification method has an optional sound name argument.

Sorry -- yes, I should have said "can't natively only play sounds".

fantastic!! many thanks for this - does this clean up after it? (i.e. does this afplay stay open and eat resources/ processes, or does it automatically close/ clean up after the sound is played)