The play metronome is apparently working (no idea about the record metronome),
although here it's a bit elusive. The sequencer traces indicate the events
are there and played, but my synth doesn't always make a sound.
Implementation is what we discussed (generated non-repeating segment with
ticks computed from the function Chris posted). I haven't fully tested how
it's updated when the composition changes, though.