Few days ago I asked how to get the number of beats and the duration of
each beat of a measure.

The reason was that I wanted to try to write some facilities to add a
ticktock measure at the beginning of a score:

My idea was to transform a score like this

\version "2.19.81"
music = {\time 3/4 a b c'}

\score {
  \new Staff \music
  \layout {}  \midi {}
}

[image: image.png]

to something like this

\version "2.19.81"
music = {\time 3/4 a b c'}
myRests = {\time 3/4 r4 r r}
ticktock = \drummode {\time 3/4 hihat bassdrum bassdrum}

\score {
  <<
    \new Staff {\myRests \music}
    \new DrumStaff { \ticktock}
  >>
  \layout {}  \midi {}
}

[image: image.png]

For this I thought to write a substitution function etc. Something like
this (it doesn't compile):

\version "2.19.81"
myScore =
#(define-void-function (music) (ly:music?)
   (let (myRests #{ \time 3/4 r4 r r #} ) (ticktock #{ \time 3/4 hihat
bassdrum bassdrum #}))
   #{
     \score {
       <<
         \new Staff {\myRests $music}
         \new DrumStaff { \ticktock}
       >>
       \layout{} \midi{} } #})

music = {\time 3/4 a b c'}

\myScore \music

The "let" part is not correct. I don't know how to define variable
containing lilypond code using let. So any suggestion is appreciated.
And of course the function should create a myRests  and ticktock of the
right length according to the $music contents.
Any help is appreciate.
Thank you, g.
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to