Ist so etwas überhaut möglich mit lylipond?
Es würde mir aber sehr helfen, wenn Du ein kurzes kompilierbares Beispiel mit Angabe der Versionsnummer posten könntest welches das Problem und Deine bisherigen Lösungsversuche zeigt. (Das solltest Du übrigens immer machen!!)
\version "2.14.0" % necessary for upgrading to future LilyPond versions.
\layout {
}
\header { tagline = ##f }
#(set-global-staff-size 20)
\paper {
system-system-spacing #'basic-distance = #20
indent = #(* mm 0)
top-margin = #(* mm 20)
}
\layout {
\context {
\Score
%\remove "Bar_number_engraver"
}
}
#(define mydrums '(
(bassdrum default #f -5)
(snare default #f 0)
(hihat cross #f 5)
(pedalhihat cross #f -3)
(openhihat xcircle #f 5)
(lowtom default #f 1)
(hightom default #f 3)
(lowfloortom default #f -1)
(ridecymbal harmonic-black #f 6)
(ridebell harmonic-black #f 5)
(crashcymbal harmonic-black #f 7)
)
)
oben = \drummode {
\numericTimeSignature
\time 4/4
{
\override TextScript #'script-priority = #100
cymc8\upbow rb
rb16 rb16 rb8
rb8 rb16 rb16
rb8 rb16 rb16
}
}
unten = \drummode
{
bd16 hhp sn hhp
sn16 hhp8 << sn16 hhp >>
%Hier ist der Fehler. sn16 wird ohne Notenkopf dargestellt. Leider aber auch hhp
bd16 << \once \override NoteHead #'transparent = ##t sn16 hhp >> << \parenthesize sn >> hhp
r16 << sn8 hhp >> hhp16
}
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \unten }
>>
\version "2.14.0" % necessary for upgrading to future LilyPond versions.
\layout {
}
\header { tagline = ##f }
#(set-global-staff-size 20)
\paper {
system-system-spacing #'basic-distance = #20
indent = #(* mm 0)
top-margin = #(* mm 20)
}
\layout {
\context {
\Score
%\remove "Bar_number_engraver"
}
}
#(define mydrums '(
(bassdrum default #f -5)
(snare default #f 0)
(hihat cross #f 5)
(pedalhihat cross #f -3)
(openhihat xcircle #f 5)
(lowtom default #f 1)
(hightom default #f 3)
(lowfloortom default #f -1)
(ridecymbal harmonic-black #f 6)
(ridebell harmonic-black #f 5)
(crashcymbal harmonic-black #f 7)
)
)
oben = \drummode {
\numericTimeSignature
\time 4/4
{
\override TextScript #'script-priority = #100
cymc8\upbow rb
rb16 rb16 rb8
rb8 rb16 rb16
rb8 rb16 rb16
}
}
unten = \drummode
{
%\override Beam #'damping = #+inf.0
\override Beam #'positions = #'(-5 . -5)
bd16 hhp sn hhp
sn16 hhp8 << sn16 hhp >>
%Hier ist der Fehler. sn16 wird ohne Notenkopf dargestellt. Leider aber auch hhp
% \tweak löst das Problem!
bd16 << <\tweak #'transparent ##t sn>16 hhp >> << \parenthesize sn >> hhp
r16 << sn8 hhp >> hhp16
}
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \unten }
>>So wie ich die Bescheibung verstehe, geht es darum, an einzelnen Noten bzw. Notenköpfen eine »kurze« Information anzuhängen, damit anschließend en Kreuz-Notenkopf benutzt wird.Ich glaube eher, daß die erstmal eingeklammerten Noten so bearbeitet werden sollen, daß anderer Output möglich wird. (Der Kreuz-Notenkopf wird ja schon in der mydrums-alist als default-Notenkopf für für zwei verschiedene Schlagzeuginstrumente benutzt)
\version "2.14.0" % necessary for upgrading to future LilyPond versions.
#(define ((affect-parenthesized-note-heads property value) grob)
(let* ((sys (ly:grob-system grob))
(array (ly:grob-object sys 'all-elements))
(grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name)))
(note-heads (ly:grob-object grob 'note-heads))
(note-heads-grobs (if (not (null? note-heads))
(ly:grob-array->list note-heads)
'()))
(par-lst (filter (lambda (x) (eq? 'ParenthesesItem (grob-name x)))
(ly:grob-array->list array)))
(rel-coord (lambda (z) (ly:grob-relative-coordinate z sys X)))
(proc (lambda (x)
(if (eq? (ly:prob-property (ly:grob-property x 'cause) 'parenthesize ) #t)
(begin
(ly:grob-set-property! x property value)
(map (lambda (y)
(if (= (rel-coord x) (rel-coord y))
(ly:grob-set-property! y 'transparent #t)
#f))
par-lst))
#f))))
(map proc note-heads-grobs)))
colorParenthesizedNoteHeads = \override Staff.NoteColumn #'after-line-breaking =
#(affect-parenthesized-note-heads 'color (x11-color 'grey66))
makeTransparentParenthesizedNoteHeads = \override Staff.NoteColumn #'after-line-breaking =
#(affect-parenthesized-note-heads 'transparent #t)
% Funktioniert nicht. Warum?
smallerParenthesizedNoteHeads = \override Staff.NoteColumn #'after-line-breaking =
#(affect-parenthesized-note-heads 'font-size -3)
#(define (new-stil grob)
(grob-interpret-markup grob (markup
#:with-color red
#:fontsize -2
#:rotate -90 ":)")))
newStencilParenthesizedNoteHeads = \override Staff.NoteColumn #'after-line-breaking =
#(affect-parenthesized-note-heads 'stencil new-stil)
%--- Test
\layout {
}
\header { tagline = ##f }
#(set-global-staff-size 20)
\paper {
system-system-spacing #'basic-distance = #20
indent = #(* mm 0)
top-margin = #(* mm 20)
}
\layout {
\context {
\Score
%\remove "Bar_number_engraver"
}
}
#(define mydrums '(
(bassdrum default #f -5)
(snare default #f 0)
(hihat cross #f 5)
(pedalhihat cross #f -3)
(openhihat xcircle #f 5)
(lowtom default #f 1)
(hightom default #f 3)
(lowfloortom default #f -1)
(ridecymbal harmonic-black #f 6)
(ridebell harmonic-black #f 5)
(crashcymbal harmonic-black #f 7)
)
)
oben = \drummode {
\numericTimeSignature
\time 4/4
{
\override TextScript #'script-priority = #100
cymc8\upbow rb
rb16 rb16 rb8
rb8 rb16 rb16
rb8 rb16 rb16
}
}
unten = \drummode
{
%\override Beam #'damping = #+inf.0
\override Beam #'positions = #'(-5 . -5)
bd16 hhp sn hhp
sn16 hhp8 < sn hhp >16
bd16 < \parenthesize sn hhp >16 << \parenthesize sn >> hhp
r16 << sn8 hhp >> hhp16
}
\markup \bold "Original"
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \unten }
>>
\markup \bold "Mit Farbe, hier: grau"
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \colorParenthesizedNoteHeads \unten }
>>
\markup \bold "Transparent"
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \makeTransparentParenthesizedNoteHeads \unten }
>>
% Funktioniert nicht. Warum?
% \new DrumStaff <<
% \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
% \new DrumVoice { \voiceOne \oben }
% \new DrumVoice { \voiceTwo \smallerParenthesizedNoteHeads \unten }
% >>
\markup \bold "Neuer Notenkopf"
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \newStencilParenthesizedNoteHeads \unten }
>>
\version "2.14.0" % necessary for upgrading to future LilyPond versions.
#(define ((affect-parenthesized-note-heads property value) grob)
(let* ((sys (ly:grob-system grob))
(array (ly:grob-object sys 'all-elements))
(grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name)))
(note-heads (ly:grob-object grob 'note-heads))
(note-heads-grobs (if (not (null? note-heads))
(ly:grob-array->list note-heads)
'()))
(par-lst (filter (lambda (x) (eq? 'ParenthesesItem (grob-name x)))
(ly:grob-array->list array)))
(rel-coord (lambda (z) (ly:grob-relative-coordinate z sys X)))
(proc (lambda (x)
(if (eq? (ly:prob-property (ly:grob-property x 'cause) 'parenthesize ) #t)
(begin
(ly:grob-set-property! x property value)
;(ly:prob-set-property! x 'tweak (cons 'font-size 8))
(map (lambda (y)
(if (= (rel-coord x) (rel-coord y))
(ly:grob-set-property! y 'transparent #t)
#f))
par-lst))
#f))))
(map proc note-heads-grobs)))
colorParenthesizedNoteHeads = \override Staff.NoteColumn #'after-line-breaking =
#(affect-parenthesized-note-heads 'color (x11-color 'grey66))
makeTransparentParenthesizedNoteHeads = \override Staff.NoteColumn #'after-line-breaking =
#(affect-parenthesized-note-heads 'transparent #t)
#(define (smaller-stencil grob)
(let* ((sys (ly:grob-system grob))
(rel-coord (lambda (z) (ly:grob-relative-coordinate z sys X)))
(note-heads (ly:grob-object grob 'note-heads))
(note-heads-grobs (if (not (null? note-heads))
(ly:grob-array->list note-heads)
'()))
(n-c-coord (rel-coord (ly:grob-parent grob X)))
(n-h-coord (rel-coord grob))
(stencil (ly:note-head::print grob))
(stencil-length-x (interval-length (ly:stencil-extent stencil X)))
(new-stencil (ly:stencil-scale stencil 0.7 0.7))
(new-stencil-length-x (interval-length (ly:stencil-extent new-stencil X)))
(stem (ly:grob-object grob 'stem))
(stem-dir (ly:grob-property stem 'direction))
(diff (- stencil-length-x new-stencil-length-x)))
(ly:stencil-translate-axis
new-stencil
(cond ((< stem-dir 0)
(if (> n-c-coord n-h-coord)
diff
0))
((> stem-dir 0)
(if (>= n-c-coord n-h-coord)
diff
0)))
X)))
smallerParenthesizedNoteHeads = \override Staff.NoteColumn #'stencil =
#(affect-parenthesized-note-heads 'stencil smaller-stencil)
#(define (new-stil grob)
(grob-interpret-markup grob (markup
#:with-color red
#:fontsize -2
#:rotate -90 ":)")))
newStencilParenthesizedNoteHeads = \override Staff.NoteColumn #'after-line-breaking =
#(affect-parenthesized-note-heads 'stencil new-stil)
%--- Test
\layout {
}
\header { tagline = ##f }
#(set-global-staff-size 20)
\paper {
system-system-spacing #'basic-distance = #20
indent = #(* mm 0)
top-margin = #(* mm 20)
}
\layout {
\context {
\Score
%\remove "Bar_number_engraver"
}
}
#(define mydrums '(
(bassdrum default #f -5)
(snare default #f 0)
(hihat cross #f 5)
(pedalhihat cross #f -3)
(openhihat xcircle #f 5)
(lowtom default #f 1)
(hightom default #f 3)
(lowfloortom default #f -1)
(ridecymbal harmonic-black #f 6)
(ridebell harmonic-black #f 5)
(crashcymbal harmonic-black #f 7)
)
)
oben = \drummode {
\numericTimeSignature
\time 4/4
{
\override TextScript #'script-priority = #100
cymc8\upbow rb
rb16 rb16 rb8
rb8 rb16 rb16
rb8 rb16 rb16
}
}
unten = \drummode
{
%\override Beam #'damping = #+inf.0
\override Beam #'positions = #'(-5 . -5)
bd16 hhp sn hhp
sn16 hhp8 < sn hhp >16
bd16 < \parenthesize sn hhp >16 << \parenthesize sn >> hhp
r16 << sn8 hhp >> hhp16
}
\markup \bold "Original"
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \unten }
>>
\markup \bold "Mit Farbe, hier: grau"
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \colorParenthesizedNoteHeads \unten }
>>
\markup \bold "Transparent"
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \makeTransparentParenthesizedNoteHeads \unten }
>>
\markup \bold "Kleiner Notenkopf"
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \smallerParenthesizedNoteHeads \unten }
>>
\markup \bold "Neuer Notenkopf"
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \newStencilParenthesizedNoteHeads \unten }
>>
\markup \bold "Mit Noten im Sekundabstand"
\relative c'' {
%\colorParenthesizedNoteHeads
%\makeTransparentParenthesizedNoteHeads
\smallerParenthesizedNoteHeads
%\newStencilParenthesizedNoteHeads
<d \parenthesize f \parenthesize g b>4
<d, \parenthesize f \parenthesize g b>
}allerdings hat die log-File manchmal gemeckert wenn ich nur "< >" benutzt habe.
\version "2.14.0" % necessary for upgrading to future LilyPond versions.
#(define (twitter notehead-grob)
(let*
((is-par (ly:event-property (event-cause notehead-grob) 'parenthesize))
)
(if (not (null? is-par))
(begin
; (display "\nis-par = ") (display is-par)
(if is-par
(begin
; (display "\n Parenthesized Notehad ... ")
; (ly:grob-set-property! notehead-grob 'color (x11-color 'green))
(ly:grob-set-property! notehead-grob 'font-size -4)
(ly:grob-set-property! notehead-grob 'parenthesize #f) ; no effect (parenthesis grob allready exists?)
(ly:event-set-property! (event-cause notehead-grob) 'parenthesize #f) ; no effect (parenthesis grob allready exists?)
; How to find the associated parenthesis grob, to execute 'ly:grob-suicde!' ?
)
)
)
)
)
)
% Funktioniert nicht mit after-line-breaking. Warum?
% #(define (affect-parenthesized-note-heads-size-three grob) ((affect-parenthesized-note-heads 'font-size -3) grob))
smallerParenthesizedNoteHeads = \override Staff.NoteHead #'before-line-breaking =
#twitter
% #(lambda (grob) ((affect-parenthesized-note-heads 'font-size -3) grob))
% #affect-parenthesized-note-heads-size-three
% #(affect-parenthesized-note-heads 'font-size -3)
%--- Test
\layout {
}
\header { tagline = ##f }
#(set-global-staff-size 20)
\paper {
system-system-spacing #'basic-distance = #20
indent = #(* mm 0)
top-margin = #(* mm 20)
}
\layout {
\context {
\Score
%\remove "Bar_number_engraver"
}
}
#(define mydrums '(
(bassdrum default #f -5)
(snare default #f 0)
(hihat cross #f 5)
(pedalhihat cross #f -3)
(openhihat xcircle #f 5)
(lowtom default #f 1)
(hightom default #f 3)
(lowfloortom default #f -1)
(ridecymbal harmonic-black #f 6)
(ridebell harmonic-black #f 5)
(crashcymbal harmonic-black #f 7)
)
)
oben = \drummode {
\numericTimeSignature
\time 4/4
{
\override TextScript #'script-priority = #100
cymc8\upbow rb
rb16 rb16 rb8
rb8 rb16 rb16
rb8 rb16 rb16
}
}
unten = \drummode
{
%\override Beam #'damping = #+inf.0
\override Beam #'positions = #'(-5 . -5)
bd16 hhp sn hhp
sn16 hhp8 < sn hhp >16
bd16 < \parenthesize sn hhp >16 << \parenthesize sn >> hhp
r16 << sn8 hhp >> hhp16
}
\markup \bold "Original"
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \unten }
>>
\markup \bold \column {
"Funktioniert nicht mit 'after-line-breaking', allenfalls 'before-line-breakomg'. Warum?"
"Und wie bekommt man dann die Klammern weg,"
"wenn nicht durch ein weiteres after-line-breaking?"
}
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \smallerParenthesizedNoteHeads \unten }
>>
Ich sehe drei praktikable Wege für diese Veränderungen
\version "2.14.2"
#(define (define-grob-custom-property symbol type? description)
(if (not (equal? (object-property symbol 'backend-doc) #f))
(ly:error (_ "symbol ~S redefined") symbol))
(set-object-property! symbol 'backend-type? type?)
(set-object-property! symbol 'backend-doc description)
symbol)
#(define all-user-grob-custom-properties
(map
(lambda (x)
(apply define-grob-custom-property x))
`(
(smaller-not-parenthesize-note-heads ,boolean? "boolean for making smaller parenthesized NoteHeads")
(color-not-parenthesize-note-heads ,boolean? "boolean for coloring parenthesized NoteHeads")
(transparent-not-parenthesize-note-heads ,boolean? "boolean for making transparent parenthesized NoteHeads")
(new-stencil-not-parenthesize-note-heads ,boolean? "boolean for making a new stencil for parenthesized NoteHeads")
(un-parenthesize ,boolean? "boolean for un-parenthesize NoteHeads")
)))
#(define (new-stil grob)
(grob-interpret-markup grob (markup
#:with-color red
#:fontsize -2
#:rotate -90 ":)")))
AffectParenthesizedNoteHeadsEngraver =
#(lambda (context)
`((acknowledgers
(note-head-interface .
,(lambda (engraver grob source-engraver)
(if (not (null? (ly:event-property (event-cause grob) 'parenthesize)))
(cond ((eq? #t (ly:grob-property grob 'smaller-not-parenthesize-note-heads))
(set! (ly:grob-property grob 'font-size) -3))
((eq? #t (ly:grob-property grob 'color-not-parenthesize-note-heads))
(set! (ly:grob-property grob 'color) (x11-color 'grey66)))
((eq? #t (ly:grob-property grob 'transparent-not-parenthesize-note-heads))
(set! (ly:grob-property grob 'transparent) #t))
((eq? #t (ly:grob-property grob 'new-stencil-not-parenthesize-note-heads))
(set! (ly:grob-property grob 'stencil) new-stil))
(else #f))
#f)))
(parentheses-interface .
,(lambda (engraver grob source-engraver)
(if (eq? #t (ly:grob-property grob 'un-parenthesize))
(ly:grob-suicide! grob)
#f))))))
%--- Test --%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
myLayoutI = \layout {
\context {
\Voice
\override NoteHead #'smaller-not-parenthesize-note-heads = ##t
\override ParenthesesItem #'un-parenthesize = ##t
\consists \AffectParenthesizedNoteHeadsEngraver
}
}
myLayoutII = \layout {
\context {
\Voice
\override NoteHead #'color-not-parenthesize-note-heads = ##t
\override ParenthesesItem #'un-parenthesize = ##t
\consists \AffectParenthesizedNoteHeadsEngraver
}
}
myLayoutIII = \layout {
\context {
\Voice
\override NoteHead #'transparent-not-parenthesize-note-heads = ##t
\override ParenthesesItem #'un-parenthesize = ##t
\consists \AffectParenthesizedNoteHeadsEngraver
}
}
myLayoutIV = \layout {
\context {
\Voice
\override NoteHead #'new-stencil-not-parenthesize-note-heads = ##t
\override ParenthesesItem #'un-parenthesize = ##t
\consists \AffectParenthesizedNoteHeadsEngraver
}
}
myLayoutV = \layout {
\context {
\DrumStaff
\override NoteHead #'smaller-not-parenthesize-note-heads = ##t
\override ParenthesesItem #'un-parenthesize = ##t
\consists \AffectParenthesizedNoteHeadsEngraver
}
}
myLayoutVI = \layout {
\context {
\DrumStaff
\override NoteHead #'color-not-parenthesize-note-heads = ##t
\override ParenthesesItem #'un-parenthesize = ##t
\consists \AffectParenthesizedNoteHeadsEngraver
}
}
myLayoutVII = \layout {
\context {
\DrumStaff
\override NoteHead #'transparent-not-parenthesize-note-heads = ##t
\override ParenthesesItem #'un-parenthesize = ##t
\consists \AffectParenthesizedNoteHeadsEngraver
}
}
myLayoutVIII = \layout {
\context {
\DrumStaff
\override NoteHead #'new-stencil-not-parenthesize-note-heads = ##t
\override ParenthesesItem #'un-parenthesize = ##t
\consists \AffectParenthesizedNoteHeadsEngraver
}
}
music = \relative c' {
<fis \parenthesize d'>4
<g \parenthesize d'>
}
\score {
\new Staff
\relative c' {
\once\override NoteHead #'smaller-not-parenthesize-note-heads = ##t
\once\override ParenthesesItem #'un-parenthesize = ##t
\music
\once\override NoteHead #'color-not-parenthesize-note-heads = ##t
\once\override ParenthesesItem #'un-parenthesize = ##t
\music
\once\override NoteHead #'transparent-not-parenthesize-note-heads = ##t
\once\override ParenthesesItem #'un-parenthesize = ##t
\music
\once\override NoteHead #'new-stencil-not-parenthesize-note-heads = ##t
\once\override ParenthesesItem #'un-parenthesize = ##t
\music
}
\layout {
\context {
\Voice
\consists \AffectParenthesizedNoteHeadsEngraver
}
}
}
\score {
\new Staff <<
\new Voice { \voiceOne \music }
\new Voice \transpose c c, { \voiceTwo \music }
>>
\layout {
\myLayoutI
}
}
#(define mydrums '(
(bassdrum default #f -5)
(snare default #f 0)
(hihat cross #f 5)
(pedalhihat cross #f -3)
(openhihat xcircle #f 5)
(lowtom default #f 1)
(hightom default #f 3)
(lowfloortom default #f -1)
(ridecymbal harmonic-black #f 6)
(ridebell harmonic-black #f 5)
(crashcymbal harmonic-black #f 7)
)
)
oben = \drummode {
\numericTimeSignature
\time 4/4
{
\override TextScript #'script-priority = #100
cymc8\upbow rb
rb16 rb16 rb8
rb8 rb16 rb16
rb8 rb16 rb16
}
}
unten = \drummode
{
%\override Beam #'damping = #+inf.0
\override Beam #'positions = #'(-5 . -5)
bd16 hhp sn hhp
sn16 hhp8 < sn hhp >16
bd16 < \parenthesize sn hhp >16 << \parenthesize sn >> hhp
r16 << sn8 hhp >> hhp16
}
\score {
\new DrumStaff <<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\new DrumVoice { \voiceOne \oben }
\new DrumVoice { \voiceTwo \unten }
>>
\layout {
\myLayoutVIII
}
}