Automatic click track: Difference between revisions
Appearance
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series |
No edit summary |
||
| Line 30: | Line 30: | ||
[[Category:Rhythms]] | [[Category:Rhythms]] | ||
[[Category:Midi]] | [[Category:Midi]][[Category:Snippet]] | ||
Revision as of 22:47, 21 November 2025
Here is a simple function to automatically add a MIDI click track to any music expression, without altering the graphical output.
\version "2.24"
%%LSR contributed by vv on https://lists.gnu.org/archive/html/lilypond-user/2020-06/msg00070.html
addTicks =
#(define-music-function (m) (ly:music?)
#{ << $m
\new Devnull \with {
\consists Drum_note_performer
\consists Staff_performer
\consists Dynamic_performer
midiInstrument = #"woodblock"
} \drummode {
<>\ff \repeat unfold
$(ly:moment-main-numerator
(ly:moment-div
(ly:music-length m)
(ly:make-moment 1 4)))
rb4 }>> #})
music = \relative c' { c2\pp d e f g a b c }
\score {
\new Staff \addTicks \music
\layout {}
\midi {}
}