lilypond-user
[Top][All Lists]
Advanced

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

Creating click tracks for an arbitrary time signature and length of musi


From: Matt Wallis
Subject: Creating click tracks for an arbitrary time signature and length of music
Date: Thu, 19 Dec 2019 23:03:12 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.9.1

For some compositions, I create midi output with click tracks.

If the music is in 4/4 time and of 64 measures in length, the the click track looks like this:

  \repeat unfold 64 \drummode { wbh4\f wbl\pp wbl wbl }

If it's in 6/8 time, and 40 measures in length, it looks like this:

  \repeat unfold 40 \drummode { wbh8\f wbl\pp wbl wbl wbl wbl}

What I want to do is to automatically create a click track for any length of music, and any time signature. For example, if the music is L measures in length, and the numerator of the time signature is N, and the denominator is D, then I want a click track that looks like this:

  \repeat unfold <L> \drummode { wbh<D> \repeat unfold <N-1> { wbl\pp }}

I am certain that this can be done using scheme, but I can't figure out how (I'm a scheme novice).

Looking at http://lilypond.org/doc/v2.19/Documentation/internals/music-properties, I see there are properties that look very pertinent:

numerator (integer) - numerator of a time signature
denominator (integer) - denominator of a time signature
length (moment) - The duration of this music

So, supposing I have music of two bars in length:

  music = { c8 d e f g a | a g f e d c }

and a time signature:

  timeSignature = \time 6/8

how do I write a scheme function that uses the lilypond variables \music and \timeSignature to generate my desired click track

  \repeat unfold 2 \drummode { wbh8\f \repeat unfold 5 { \wbl\pp } }

?



reply via email to

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