lilypond-devel
[Top][All Lists]
Advanced

[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 2.0.0.5 (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.

  /Mats

gnomino wrote:
I'm not top-posting

Hello,

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
'(DynamicLineSpanner)))
        \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
   '(DotColumn
     Dots
     Fingering


Patch #2:
--- a/ly/property-init.ly
+++ b/ly/property-init.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
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-devel

--
=============================================
        Mats Bengtsson
        Signal Processing
        School of Electrical Engineering
        Royal Institute of Technology (KTH)
        SE-100 44  STOCKHOLM
        Sweden
        Phone: (+46) 8 790 8463                         
       Fax:   (+46) 8 790 7260
        Email: address@hidden
        WWW: http://www.s3.kth.se/~mabe
=============================================





reply via email to

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