On 11/05/2024 18:42, Steph Phillips wrote:

%%%%%%%%%%%%%%%%%%%%

Pretty happy with how that looks, but now I'm having trouble converting it to a function. The following is what I've put together, but I can't seem to shake the compiler error.


The parameters feather-ratio, tuplet-ratio are not moments, but ratios. Also, the parser and location arguments have not been required for several releases of LilyPond. Here is a working version of your function.

\version "2.24.2"

customTuplet = #(define-music-function
  (displayed-note y-off beam-left tuplet-up feather-ratio tuplet-ratio notes)
  (number? number? boolean? boolean? rational? pair? ly:music?)
   #{
     \once \override TupletNumber.text = \markup { \note-by-number #displayed-note #0 #UP }
     \once \override TupletBracket.bracket-visibility = ##t
     \once \override TupletBracket.visible-over-note-heads = ##t
     \once \override TupletBracket.Y-offset = #y-off
     \once \override Beam.grow-direction = #(if beam-left LEFT RIGHT)
     #(if tuplet-up
        #{ \tupletUp \tuplet #tuplet-ratio {
             \featherDurations #feather-ratio { $notes }
           } #}
        #{ \tupletDown \tuplet #tuplet-ratio {
             \featherDurations #feather-ratio { $notes }
           } #}
     )
   #})

\score {
  \relative c'' {
    \time 4/4

    \customTuplet #1 #-1.5 ##t ##t #2/1 #'(6 . 8) {
      d16[-. d-. d-. d-. d-. d]-.
    }

    \customTuplet #2 #-1.5 ##f ##f #2/1 #'(5 . 8) {
      e16[-. e-. e-. e-. e-. e]-.
    }
  }
}

--
Timothy Lanfear, Bristol, UK.

Reply via email to