lilypond-user
[Top][All Lists]
Advanced

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

help with writing scheme function for divisi


From: Shevek
Subject: help with writing scheme function for divisi
Date: Thu, 27 Oct 2011 22:13:52 -0700 (PDT)

I just hacked together a couple simple functions to streamline the process of divisi writing. They basically work, but I have a couple issues. First, why does the instrumentCueName display three times? Is there a way to get it to only display once? Second, it's a bit annoying to have to enter \voiceOne and \oneVoice in the non-divisi voice. Is there a way to e.g. set \oneVoice not for the current context, but rather for a different named context?
\version "2.14.2"
\language "english"

\paper {
  left-margin = 1\in
  right-margin = 1\in
  top-margin = 1\in
  bottom-margin = 1\in
  ragged-bottom = ##t
  oddFooterMarkup=##f
  oddHeaderMarkup=##f
  bookTitleMarkup = ##f
  scoreTitleMarkup = ##f
}

divisiDown = #(define-music-function
  (parser location staff grp_name s1_name s2_name)
  (string? markup? markup? markup?)
  (make-sequential-music
    (list
      #{
        \set Staff.shortInstrumentName = $s1_name
      #}
      (make-music
        'ContextChange
        'change-to-id staff
        'change-to-type 'Staff)
      #{
        \set StaffGroup.shortInstrumentName = $grp_name
        \set Staff.shortInstrumentName = $s2_name
        \oneVoice
      #}
      )
    )
  )

divisiUp = #(define-music-function
  (parser location staff grp_name s_name cue)
  (string? markup? markup? markup?)
  (make-sequential-music
    (list
      (make-music
        'ContextChange
        'change-to-id staff
        'change-to-type 'Staff)
      #{
        \voiceTwo
        \set StaffGroup.shortInstrumentName = $grp_name
        \set Staff.shortInstrumentName = $s_name
        \set Staff.instrumentCueName = $cue
      #}
      )
    )
  )

obI = \relative c'' {
  \tag #'score \voiceOne
  c4 d e d |
  c4 d e d |
  c4 d e d |
  c4 d e d |
  \tag #'score \oneVoice
  c4 d e d |
  c4 d e d |
  c4 d e d |
  c4 d e d |
  \tag #'score \voiceOne
  c4 d e d |
  c4 d e d |
  c4 d e d |
  c4 d e d |
}

obII = \relative c' {
  \tag #'score \voiceTwo
  e4 f g f |
  e4 f g f |
  e4 f g f |
  e4 f g f |
  \tag #'score \divisiDown #"Ob2" "Oboe  " "1" "2"
  e4 f g f |
  e4 f g f |
  e4 f g f |
  e4 f g f |
  \tag #'score \divisiUp #"Ob1" "Oboe  " \markup \column {"1" "2"} "a2"
  c'4 d e d |
  c4 d e d |
  c4 d e d |
  c4 d e d |
}

global = {
  s1*4 | \break
  s1*4 | \break
  s1*4 |
}

\score {
  \keepWithTag #'score <<
    \new StaffGroup \with {
      instrumentName = "Oboe 1-2"
      shortInstrumentName = "Ob. 1-2"
      systemStartDelimiter = #'SystemStartSquare
      %This is to keep the bracket from displaying when there is only one staff
      \override SystemStartSquare #'collapse-height = #5
    } <<
      \new Staff = "Ob1" << \global <<
          \obI
          \\
          \obII
        >>
      >>
      \new Staff = "Ob2" \with {
        %This is all from a snippet to have the second staff display only when
        %There are notes in it
        \remove "Axis_group_engraver"
        \consists "Hara_kiri_engraver"
        \override Beam #'auto-knee-gap = #'()
        \override VerticalAxisGroup #'remove-empty = ##t
        \override VerticalAxisGroup #'remove-first = ##t 
      } \global
    >>
  >>
  \layout {}
}


View this message in context: help with writing scheme function for divisi
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.

reply via email to

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