Notationsspezifisch > Noten für Schlagzeug

Schlagzeug und Tonhöhen auf einem System?

<< < (2/2)

harm6:
Hallo jo,

hervorragende Optimierung !!

Mir ging allerdings durch den Kopf, daß man auch mal die Mehrstimmigkeit probieren sollte. Das könnte dann so aussehen:


--- Code: ---\version "2.12.3"

\addInstrumentDefinition #"Xylophon"
  #`((instrumentTransposition . ,(ly:make-pitch 0 0 0))
     (shortInstrumentName . "Xylo.")
     (clefGlyph . "clefs.G")
     (middleCPosition . 1)
     (clefPosition . -2)
     (instrumentCueName . ,(make-bold-markup "Xyl."))
     (midiInstrument . "xylophone")
    )
   
\addInstrumentDefinition #"Percussion"
  #`((shortInstrumentName . "Perc.")
     (instrumentName . "Percussion")
     (clefGlyph . "clefs.percussion")
     (clefPosition . 0)
     (instrumentCueName . ,(make-bold-markup "Perc."))
    )

one = {
      \drummode { sn2 sn2 R1 }     
   
      \instrumentSwitch "Xylophon"
      \new Voice { \relative c' { \voiceOne c4 d e f R1 } }
   
      \instrumentSwitch "Percussion"
      { \drummode { sn2 sn R1 }     }
     
      \instrumentSwitch "Xylophon"
      \new Voice { \relative c' { \voiceOne f4 e d c R1 } }   
    }
   
two = {
      \drummode { bd2 bd  R1 }
   
      \new Voice \with { instrumentCueName = " " } { \relative c' { \voiceTwo c,4 d e f R1 } }
   
      { \drummode { bd2 bd R1 }     }
     
      \new Voice \with { instrumentCueName = " " } { \relative c' { \voiceTwo f,4 e d c R1 } }   
    }
   
\new DrumStaff \with { \accepts Voice } {
     <<
    \instrumentSwitch "Percussion"
    \new DrumVoice \with { instrumentCueName = " " }
    {\voiceOne \one }
    \new DrumVoice \with { instrumentCueName = " " }
    {\voiceTwo \two }
    >>
  }
--- Ende Code ---

Aber ich finde den Code unübersichtlich! Deshalb hab' ich mir noch ein paar Sachen aus den Fingern gesaugt:


--- Code: ---\version "2.12.3"

withCue =
#(define-music-function (parser location stringCue music)(string? ly:music?)
#{
        \new Voice \with { instrumentCueName = \markup\bold $stringCue }
        $music
#})

withOutCue =
#(define-music-function (parser location music)(ly:music?)
#{
        \new Voice $music
#})

xyl =
#(define-music-function (parser location arg music)(integer? ly:music?)
#{
        #(define voiceDir   
          (if (<= $arg 3)
              (context-spec-music (make-voice-props-set $arg)  'Voice)
              (context-spec-music (make-voice-props-revert) 'Voice)
              ))
             
        \addInstrumentDefinition #"Xylophon"
          #`((instrumentTransposition . ,(ly:make-pitch 0 0 0))
             (shortInstrumentName . "Xylo.")
             (clefGlyph . "clefs.G")
             (middleCPosition . 1)
             (clefPosition . -2)
             (instrumentCueName . ,(make-bold-markup "Xyl."))
             (midiInstrument . "xylophone")
            )
       
        \instrumentSwitch "Xylophon"   
        \relative c' { \voiceDir $music }   
#})

perc =
#(define-music-function (parser location arg music)(integer? ly:music?)
#{
        #(define voiceDir   
          (if (<= $arg 3)
              (context-spec-music (make-voice-props-set $arg)  'Voice)
              (context-spec-music (make-voice-props-revert) 'Voice)
              ))
             
        \addInstrumentDefinition #"Percussion"
          #`((shortInstrumentName . "Perc.")
             (instrumentName . "Percussion ")
             (clefGlyph . "clefs.percussion")
             (clefPosition . 0)
             (instrumentCueName . ,(make-bold-markup "Perc."))
            )
       
        \instrumentSwitch "Percussion"   
         { \voiceDir $music }   
#})

%--------------------------- Test ----------------------------------------------

three = {
      \perc #0 \drummode { sn2 sn2 R1 }     
   
      \withCue #" " \xyl #0  { c4 d e f R1 }
   
      \perc #0 \drummode { sn2 sn R1 }
     
      \withCue #" " \xyl #0  { f4 e d c R1 } 
    }
   
four = {
      \perc #1 \drummode { bd2 bd  R1 }
   
      \withOutCue \xyl #1  { c,4 d e f R1 }
   
      \perc #1 \drummode { bd2 bd R1 }
     
      \withOutCue \xyl #1  { f,4 e d c R1 } 
    }

\new DrumStaff \with { \accepts Voice } {
     <<
    \new DrumVoice \with { instrumentCueName = " " }
    \three
    \new DrumVoice \with { instrumentCueName = " " }
    \four
    >>
     
  }
--- Ende Code ---

\withCue #" "  und \withOutCue sind dazu da ganz nach belieben \new voice \with { instrumentCueName = " " } zu setzen oder nur \new voice .
\xyl macht dann den \instrumentSwitch zum Xylophon. \perc entsprechend. In beiden Funktionen gibt es eine Definition für voiceDir, damit spart man sich die Angabe von \voiceOne etc.
In \xyl #0 bedeutet die 0 also \voiceOne. 1 2 3 also \voiceTwo \voiceThree \voiceFour . Höhere Zahlen führen zu \oneVoice.

Gruß,
  Harm

P.S. Ich würde einen Thread, von Ausnahmefällen mal abgesehen, nie schließen, denn allein schon durch die Versionswechseleien gibt es immer wieder neues zu beachten und zu entdecken. (z.B.: 2.14.2 bietet die Möglichkeit \with-Ausdrücke in Variablen zu speichern)

Navigation

[0] Themen-Index

[*] Vorherige Sete

Zur normalen Ansicht wechseln