lilypond-user
[Top][All Lists]
Advanced

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

Re: Obtain the number of notes and rests from "ly:music?" parameter pass


From: Paolo Prete
Subject: Re: Obtain the number of notes and rests from "ly:music?" parameter passed to a function
Date: Fri, 2 Mar 2018 20:42:31 +0000 (UTC)

Meanwhile, I found a solution for my question, for anyone who could be interested:

%%%%%%%%
createTuplet = #(define-music-function (parser location notes) (ly:music?)
(let
  ((noteCount (length (extract-typed-music notes '(note-event event-chord rest-event skip-event))))
  )   
#{ 
  \times #(cons 2 noteCount) $notes
#}))

{
\createTuplet {<c' g'> e' s g r}
}


Il Venerdì 2 Marzo 2018 18:33, Paolo Prete <address@hidden> ha scritto:


Hello,

in the snippet below how can I replace "4" (in the denominator of "\times") with the number of notes+rests (including "s") in $notes ?

Thanks


%%%%%%%%

createTuplet = #(define-music-function (parser location notes) (ly:music?)
#{
  \times 2/4 $notes
#})

{
  \createTuplet {c' e' r g'}
}




reply via email to

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