lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

add a ticktock measure to the beginning of a score


From: Gianmaria Lari
Subject: add a ticktock measure to the beginning of a score
Date: Tue, 26 Jun 2018 10:35:29 +0200

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.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.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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]