[Top][All Lists]

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

Re: Parameterize an event function

From: Mark Knoop
Subject: Re: Parameterize an event function
Date: Thu, 30 Jul 2015 13:49:44 +0100

At 22:18 on 30 Jul 2015, Andrew Bernard wrote:
>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.

Use ly:duration? (although this seems extraordinarily

metroMark = #(define-event-function
  (dur arg) (ly:duration? 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 c $dur } }
        \layout {
          indent = 0
          ragged-right = ##t

{ c' \metroMark 8 " = 56" }

Mark Knoop

reply via email to

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