-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am Mittwoch, 28. Oktober 2009 20:40:05 schrieb Carl Sorensen:
> On 10/28/09 12:33 PM, "Kieren MacMillan" <[email protected]>
>
> wrote:
> > Hi all,
> >
> > Can the snippet
> >
> > <http://lsr.dsi.unimi.it/LSR/Snippet?id=554>
> >
> > be made into an automatic callback, instead of requiring the creation
> > of a markup each time? i.e., I would love to be able to say something
[...]
> > \override TimeSignature #'denominator-style = #'note
> >
> > and have all denominators be output as notes (rather than numbers).
>
> Yes, it can. Right now the only thing stopping from being automatic is
> the hardcoded 3 and 2 in tsMarkup.
[...]
> The challenge is that you need to have a context in order to return (as
> opposed to setting) the timeSignatureFraction, so you'd need to make a
> music function that returned context-spec-music in order to get the
> context -- that's somewhat tricky.
[...]
> a new style could be added (either to the c++ or to a new scheme file that
> implements all of the current time signatures) -- note-denominator
>
> Then you'd do
>
> \override TimeSignature #'style=#'note-denominator.
It's way simpler: Simply write your own stencil function, which gets the
TimeSignature grob when evaluated. You can use the 'fraction grob-property and
create the desired stencil from that fraction... All you have to do is to
override the TimeSignature #'stencil with your own function and you are done.
Example is attached (and uploaded to the LSR:
http://lsr.dsi.unimi.it/LSR/Item?id=642 ).
Of course, any approach based on the \time signature will never be able to
format e.g. 6/8 as 2/(dotted quarter), etc.
Cheers,
Reinhold
- --
- ------------------------------------------------------------------
Reinhold Kainhofer, [email protected], http://reinhold.kainhofer.com/
* Financial & Actuarial Math., Vienna Univ. of Technology, Austria
* http://www.fam.tuwien.ac.at/, DVR: 0005886
* LilyPond, Music typesetting, http://www.lilypond.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iD8DBQFK6NZSTqjEwhXvPN0RAtuLAJ9Rd1VaKuZktcUoL+ANsuJdoEMc4ACfdubj
oD6CJa8P0r2cwjdpj5paBAI=
=7fh2
-----END PGP SIGNATURE-----
\version "2.13.7"
#(define-public (format-time-sig-note grob)
(let* ((frac (ly:grob-property grob 'fraction))
(num (if (pair? frac) (car frac) 4))
(den (if (pair? frac) (cdr frac) 4))
(m (markup #:override '(baseline-skip . 0.5)
#:center-column (#:number (number->string num)
#:override '(style . 'default)
#:note (number->string den) DOWN))))
(grob-interpret-markup grob m)))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Some sample music
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\relative c' {
\override Staff.TimeSignature #'stencil = #format-time-sig-note
\time 2/4
\repeat unfold 4 c4
\time 3/8
\repeat unfold 3 c8
\time 3/16
\repeat unfold 3 c16
\time 3/1
\repeat unfold 3 c1
\time 5/2
\repeat unfold 5 c2
\bar"|."
}
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user