The missing metronome for Emacs

New git repository added

11 months ago



The missing metronome for GNU Emacs.


This package is available in the MELPA repository and can be installed from the Emacs package manager. To install it from source, add metronome.el to your load path and require it:

(add-to-list 'load-path "/path/to/metronome.el")
(require 'metronome)
(global-set-key (kbd "C-c m") 'metronome)


M-x metronome RET 120 RET

then M-x metronome to pause/resume, and C-u M-x metronome to set a new tempo. See the wiki for more information.

#Flashing the modeline on every beat

(defun metronome-flash-mode-line ()
  (let ((visible-bell nil)
         (lambda ()
           (invert-face 'mode-line)
           (run-with-timer 0.1 nil #'invert-face 'mode-line))))

(advice-add 'metronome-play-click :before #'metronome-flash-mode-line)

#Interacting with the metronome outside Emacs

#!/usr/bin/env bash

timer=$(emacsclient -e "metronome-timer");

if [ $# -eq 1 ] || [ "$timer" == nil ]
    tempo=$(zenity --entry --title "Metronome" --text "Tempo: ")
    emacsclient -e -a "" "(metronome-start $tempo)"
    emacsclient -e "(call-interactively #'metronome)"

#A note on accuracy

The time intervals are good enough as a general reference, but perfect timing is difficult on a multitasking system, so expect some limping when the system is loaded. A better (but more advanced) option is to use the JACK sound server daemon, or the cl-collider library to connect to the SuperCollider server.