lilypond-user
[Top][All Lists]
Advanced

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

Re: TupletNumber with tuplet-number::calc-fraction-text and \note


From: Reinhold Kainhofer
Subject: Re: TupletNumber with tuplet-number::calc-fraction-text and \note
Date: Tue, 3 Jun 2008 19:23:13 +0200
User-agent: KMail/1.9.9

Am Dienstag, 3. Juni 2008 schrieb v!ictor address@hidden:
> I believe this is what you want. It's a bit of a hack because you need
> to specify the tuplet ratio twice, in the \times command and in the
> actual markup. You could define your own function that takes two
> numbers (n and d) and wraps both the \times n/d and the TupletNumber
> #'text override.

Alternatively, one can simply extend the internal functions, which produce the 
tuplet numbers to include the note, too.

Here is an example (.ly and .pdf are attached, too) of a wrapper function for 
the #'text property, which takes as an argument the internal function to be 
used (i.e. tuplet-number::calc-fraction-text to produce 3:2 or 
tuplet-number::calc-denominator-text to produce 3) and the length of the 
note. In my function, I call the internal function to produce the text and 
then only append the note, so there's no need to repeat the fraction and it 
works for both the "3:2" and "3" styles of the tuplet number...

%%% BEGIN %%%
\version "2.11.45"

#(define-public ((tuplet-number::append-note-wrapper function note) grob)
  (let* ((txt (function grob)))
    (markup txt #:fontsize -5 #:note note UP)))
  
{
  \override TupletNumber #'text = #(tuplet-number::append-note-wrapper
                            tuplet-number::calc-fraction-text "4")
  \times 2/3 {c'4 c' c'}
  \times 2/3 {c' c' c'} 

  \override TupletNumber #'text = #(tuplet-number::append-note-wrapper
                         tuplet-number::calc-fraction-text "8")
  \times 2/3 {c'8 c' c'}
  \times 4/6 {c'4:8 c'4:8 c'4:8}
  \times 2/3 {c'8 c'8 c'8}
  \times 2/3 {c'4 c' c'}
  \times 8/12 {c':16 c':16 c':16}

  \override TupletNumber #'text = #(tuplet-number::append-note-wrapper
                        tuplet-number::calc-denominator-text "8")
  \times 2/3 {c'8 c' c'}
  \times 4/6 {c'4:8 c'4:8 c'4:8}
}

%%% END %%%

Cheers,
Reinhold

-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: address@hidden, http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/

Attachment: tuplet-append-note.ly
Description: Text Data

Attachment: tuplet-append-note.pdf
Description: Adobe PDF document


reply via email to

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