• Willkommen im Forum „Archiviertes Lilypond Forum (2017)“.
 

Dies ist das Archiv des alten Forums (bis März 2017). Das aktuelle Forum ist unter lilypondforum.de zu finden.
This is the archive of the old forum (until March 2017). You can find the current forum at lilypondforum.de.

Hauptmenü

customized staff-sizes [war: Verbesserung der LilyPond-Eingabe-Syntax!?]

Begonnen von harm6, Samstag, 29. September 2012, 17:19

Vorheriges Thema - Nächstes Thema

harm6

Zitat von: fugenkomponist
Bei Kammermusik mit Klavier werden ja die anderen Instrumente auf kleineren Systemen dargestellt. Bisher kenn ich da nur so Konstrukte wie

\new Staff \with{
    fontSize = #-3
    \override StaffSymbol #'staff-space = #(magstep -3)
    \override StaffSymbol #'thickness = #(magstep -3)
}

Daran gefällt mir nicht, dass ich drei Sachen setzen muss, um eigentlich eine Sache zu bewirken (nämlich das ganze System kleiner zu kriegen) und außerdem fänd ich nen Default-Wert sinnvoll (es wird doch bestimmt nen Erfahrungswert oder Regeln geben, wieviel kleiner die anderen Instrumente oder auch ossia-Stimmen dargestellt werden).
Mit anderen Worten: ein \new SmallStaff oder \new Staff \with { size = small } wär schön.
-> https://archiv.lilypondforum.de/index.php?topic=1213.msg6680#msg6680

Hallo,

schon mit den jetzt vorhandenen Möglichkeiten gibt es mehrere Methoden so etwas umzusetzen.

(1)
Man kann \with { ... } in eine Variable packen. Das führt zu:


myStaffSize =
\with {
        fontSize = #-3
        \override StaffSymbol #'staff-space = #(magstep -3)
        \override StaffSymbol #'thickness = #(magstep -3)
}

\new Staff \myStaffSize <music>



(2)
Man kann die Befehle in eine Musikfunction stecken und eine Variable für unterschiedliche Werte einführen.
Das führt zu:


changeStaffSize =
#(define-music-function (parser location size)(number?)
#{
    \set Staff.fontSize = #size
    \override Staff.StaffSymbol #'staff-space = #(magstep size)
    \override Staff.StaffSymbol #'thickness = #(magstep size)
#})

\new Staff \with { \changeStaffSize #-3 } <music>



(3)
Das \with aus Möglichkeit (2) kann man natürlich wiederum in eine Variable setzen.
Das führt zu:


changeStaffSize =
#(define-music-function (parser location size)(number?)
#{
    \set Staff.fontSize = #size
    \override Staff.StaffSymbol #'staff-space = #(magstep size)
    \override Staff.StaffSymbol #'thickness = #(magstep size)
#})

withSmallerStaff = \with { \changeStaffSize #-3 }

\new Staff \withSmallerStaff <music>


(4)
Man kann auch eine music-function definieren welche einen kleineren (größer ginge entsprechend) Staff ausgibt.
Das führt zu:

SmallStaff =
#(define-music-function (parser location music)(ly:music?)
#{
        \new Staff \with {
        fontSize = #-3
        \override StaffSymbol #'staff-space = #(magstep -3)
        \override StaffSymbol #'thickness = #(magstep -3)
        }
        $music
#})

\SmallStaff <music>


Hier könnte man die Größe wohl auch noch variabel angeben (hab' ich aber nicht getestet).

(5)
Man kann einen neuen Kontext definieren.
Das führt zu:



\layout {
        \context {
                \Staff
               
                \description "Sets a lower staff-size"
               
                \name "SmallerStaff"
                \alias Staff
               
                fontSize = #-3
                \override StaffSymbol #'staff-space = #(magstep -3)
                \override StaffSymbol #'thickness = #(magstep -3)
        }
       
        \context {
        \Score
        \accepts SmallerStaff
        }
       
        \context {
        \StaffGroup
        \accepts SmallerStaff
        }
       
        \context {
        \ChoirStaff
        \accepts SmallerStaff
        }
       
}

\new SmallerStaff <music>


Hier alles in zusammen in einem kompilierbaren file:


\version "2.16.0"

myStaffSize =
\with {
        fontSize = #-3
        \override StaffSymbol #'staff-space = #(magstep -3)
        \override StaffSymbol #'thickness = #(magstep -3)
}

changeStaffSize =
#(define-music-function (parser location size)(number?)
#{
    \set Staff.fontSize = #size
    \override Staff.StaffSymbol #'staff-space = #(magstep size)
    \override Staff.StaffSymbol #'thickness = #(magstep size)
#})

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

withSmallerStaff = \with { \changeStaffSize #-3 }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SmallStaff =
#(define-music-function (parser location music)(ly:music?)
#{
        \new Staff \with {
        fontSize = #-3
        \override StaffSymbol #'staff-space = #(magstep -3)
        \override StaffSymbol #'thickness = #(magstep -3)
        }
        $music
#})

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

myLayout =
\layout {
        \context {
                \Staff
               
                \description "Sets a lower staff-size"
               
                \name "SmallerStaff"
                \alias Staff
               
                fontSize = #-3
                \override StaffSymbol #'staff-space = #(magstep -3)
                \override StaffSymbol #'thickness = #(magstep -3)
        }
       
        \context {
        \Score
        \accepts SmallerStaff
        }
       
        \context {
        \StaffGroup
        \accepts SmallerStaff
        }
       
        \context {
        \ChoirStaff
        \accepts SmallerStaff
        }
       
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\header {
        title = \markup {
        \column {
                "Customized Staff-Sizes"
                \vspace #1
        }
        }
        subtitle = \markup {
        \center-column {
        "the following commands are used"
        \italic \fontsize #-3 "fontSize = #-3"
        \italic \fontsize #-3 "\\override StaffSymbol #'staff-space = #(magstep -3)"
        \italic \fontsize #-3 "\\override StaffSymbol #'thickness = #(magstep -3)"
        }
        }
        subsubtitle = \markup \vspace #2
}
       
m = \relative c' {
        \repeat unfold 3 { c1 d e f \break } \bar "|."
}

\score {     
        \new StaffGroup <<
          \new Staff = "1" \myStaffSize \m
         
          \new Staff = "2" \with { \changeStaffSize #-3 } \m
         
          \new Staff = "3" \withSmallerStaff \m
         
          \SmallStaff \m
         
          \new SmallerStaff = "5" \m
         
          \new Staff= "6" \m
        >>
        \layout { \myLayout }
}


Ganz allgemein muß man allerdings sagen, daß Veränderungen der Staff-Größe den ein oder anderen bug zum Vorschein bringen.


@fugenkomponist und alle anderen
Welche der obigen Möglichkeiten haltet ihr für besonders praktikabel?
Natürlich ist bislang nichts davon im source-code aber die Diskussion über Syntax-Verbesserungen ist u.a. ja gerade dafür da Vorschläge zu unterbreiten.
Ob es sinnvoll sein kann einen default-Wert für einen kleineren Staff zu setzen, wage ich jedoch nicht zu beurteilen.

Gruß,
  Harm