lilypond-user
[Top][All Lists]
Advanced

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

Parameterize an event function


From: Andrew Bernard
Subject: Parameterize an event function
Date: Thu, 30 Jul 2015 22:18:16 +1000

Greetings Ponderers,

I have written a function to generate custom metronome marks as I want them to be. But due to limitations of my understanding, this is terribly crude - it has a hardwired crotchet for the note displayed. What I really want to achieve is to be able to pass a duration into the function as a parameter and be able to have quavers or other note values a needed. So for example, I’d like to be able to say

\metroMark 8 “ = 56”

to specify a tempo of quaver equals 56. The reason I wrote this function is that using \note and \note-by-number don’t appear to give me the control over fonts that I want.

I know how to use Scheme arguments and so on, but when I pass a note into the function as ly:music it seems to upset all the following music in the score, so I am somewhat perplexed.

metroMark =
#(define-event-function (arg) (markup?)
   #{
     ^\markup \concat {
       {
         \score {
           \new Staff \with {
             \remove "Staff_symbol_engraver"
             \remove "Time_signature_engraver"
             \remove "Clef_engraver"
             \override NoteHead.font-size = -4
             \override Stem.length = 6
             \override Flag.font-size = -4
           }
           { \relative c'' { \stemUp c4 } }
           \layout {
             indent = 0
             ragged-right = ##t
           }
         }
       }
       #arg
     }
   #})

Andrew






reply via email to

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