[Top][All Lists]

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

Re: Customization of which directions \voiceOne changes

From: Mats Bengtsson
Subject: Re: Customization of which directions \voiceOne changes
Date: Wed, 01 Jul 2009 10:53:29 +0200
User-agent: Thunderbird (X11/20070716)

If you want to customize these macros, it's much better to keep the original ones untouched and
define your own versions. For example:
myVoiceOne = { \voiceOne \dynamicUp }

However, if you want to customize the way that the <<{...} \\ {...} >> construct works (since it internally does settings corresponding to \voiceOne and \voiceTwo), then we would need to modify the LilyPond implementation along the lines that you propose.


gnomino wrote:
I'm not top-posting


I was typesetting a bit of polyphonic music and wanted \voiceOne to put dynamics
above the staff. Looking at the code I realized that \voiceOne, \voiceTwo, etc.
automatically change the directions of the grobs in the hardcoded list
direction-polyphonic-grobs in the file music-functions.scm.

I made the following two patches, which make direction-polyphonic-grobs public
and also \voiceOne, \voiceTwo, ... into music functions, so that the list of
grobs can be modified by the user. Example:

\new Staff <<
        % both f and mf appear below staff
        \new Voice \relative { \voiceOne c'4\f c c c }
        \new Voice \relative { \voiceTwo g'4\mf g g g }
\new Staff <<
        % f appears above staff
        #(set! direction-polyphonic-grobs (append direction-polyphonic-grobs
        \new Voice \relative { \voiceOne c'4\f c c c }
        \new Voice \relative { \voiceTwo g'4\mf g g g }
I think that this slight modification would be useful for typesetting of
polyphonic music. Any comments would be appreciated.

Patch #1:
--- a/scm/music-functions.scm
+++ b/scm/music-functions.scm
@@ -339,7 +339,7 @@
              'symbol grob
              'grob-property gprop))
-(define direction-polyphonic-grobs
+(define-safe-public direction-polyphonic-grobs

Patch #2:
--- a/ly/
+++ b/ly/
@@ -165,11 +165,16 @@
% dynamic ly:dir? text script, articulation script ly:dir? -oneVoice = #(context-spec-music (make-voice-props-revert) 'Voice)
-voiceOne = #(context-spec-music (make-voice-props-set 0) 'Voice)
-voiceTwo = #(context-spec-music (make-voice-props-set 1) 'Voice)
-voiceThree = #(context-spec-music (make-voice-props-set 2) 'Voice)
-voiceFour = #(context-spec-music (make-voice-props-set 3) 'Voice)
+oneVoice = #(define-music-function (parser location) ()
+  (context-spec-music (make-voice-props-revert) 'Voice))
+voiceOne = #(define-music-function (parser location) ()
+  (context-spec-music (make-voice-props-set 0) 'Voice))
+voiceTwo = #(define-music-function (parser location) ()
+  (context-spec-music (make-voice-props-set 1) 'Voice))
+voiceThree = #(define-music-function (parser location) ()
+  (context-spec-music (make-voice-props-set 2) 'Voice))
+voiceFour = #(define-music-function (parser location) ()
+  (context-spec-music (make-voice-props-set 3) 'Voice))
voiceOneStyle = {
   \override NoteHead #'style = #'diamond

lilypond-devel mailing list

        Mats Bengtsson
        Signal Processing
        School of Electrical Engineering
        Royal Institute of Technology (KTH)
        SE-100 44  STOCKHOLM
        Phone: (+46) 8 790 8463                         
       Fax:   (+46) 8 790 7260
        Email: address@hidden

reply via email to

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