On Fri, Dec 6, 2013 at 2:40 PM, Noeck <noeck.marb...@gmx.de> wrote: > is it possible somehow, to split contents of a music expression into > two? I am asking for a piano staff which I would enter as follows: > upper = { a4\f g f e\p } > lower = { a,1 }
Greetings, sorry for answering so late but this message had been caught in my spam filter! What you’re describing is actually exactly what I do in my own scores: http://git.savannah.gnu.org/cgit/opus-libre.git/tree/lib/libdynamics.scm#n22 #(define (dynamic? x) (let ((name (ly:music-property x 'name))) (or (eq? name 'DynamicEvent) (eq? name 'AbsoluteDynamicEvent) (eq? name 'CrescendoEvent) (eq? name 'DecrescendoEvent) (eq? name 'SpanDynamicEvent)))) #(define removeDynamics ;; Remove untagged dynamics. (define-music-function (parser location music) (ly:music?) (if (ly:get-option 'no-auto-piano-dynamics) music (music-filter (lambda (x) (let ((tags (ly:music-property x 'tags)) (dir (ly:music-property x 'direction))) (not (and (dynamic? x) (not (memq 'staff-dynamics tags)) (null? dir))))) music)))) #(define filterDynamics ;; Like \removeWithTag, but will not affect other contexts ;; (i.e. no \change, no \bar or \time etc.) (define-music-function (parser location music) (ly:music?) (if (ly:get-option 'no-auto-piano-dynamics) (make-music 'Music 'void #t) (music-filter (lambda (x) (let ((name (ly:music-property x 'name)) (tags (ly:music-property x 'tags)) (dir (ly:music-property x 'direction))) (not (or (eq? name 'ContextChange) (eq? name 'VoiceSeparator) ;(eq? name 'ContextSpeccedMusic) (memq 'staff-dynamics tags) (ly:dir? dir))))) music)))) The advantage of the code I use is that it takes the dynamics from either the upper or the lower staff: \new PianoStaff << \new Staff \removeDynamics \upper \new Dynamics \filterDynamics << \upper \lower >> \new Staff \removeDynamics \lower >> However, all dynamics that have an explicit direction will be ignored (c^\f, c-\f or c_\f), which allows you to keep the ability of attaching some dynamics to one of the staves whenever you need to. Hope this helps! Cheers, V. Villenave. _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user