[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Tweaking diagram
From:       Gerardo Ballabio <gerardo.ballabio () gmail ! com>
Date:       2023-06-30 20:31:35
Message-ID: CA+f80t4DakOvQhKc2FydKhiyJz+Qv1iUoO-qsbAHUdFCnvoFqw () mail ! gmail ! com
[Download RAW message or body]

Hello all,
source file and compiled output attached. Please forgive me if this
isn't a "tiny example", but I believe I need to show the full thing in
order to communicate clearly what I am trying to do.

I'm creating an illustrative diagram to demonstrate visually the
relation between the different clefs. I've managed to get quite close
to what I want, but there are a few issues that I haven't been able to
fix:

1. In the upper double staff, I'd like to draw the staves closer to
each other. Specifically, the vertical distance because the central C
and the preceding B should be the same as for all the other pairs of
notes. I tried to set StaffGrouper.staff-staff-spacing.basic-distance
to a negative value, but apparently that is not allowed ("programming
error: insane spring distance requested, ignoring it").

2. In the lower staff, in the first and last measure the note stems
are too long. This is because they aim towards the "central" line of
the staff which is actually outside it. I haven't found a way to tweak
the stem length, nor to shift the staff up or down in another way than
by changing Staff.StaffSymbol.line-positions.

3. Also in the lower staff, I'd like bar lines to extend from the
bottom line of the preceding measure to the top line of the following
measure, that is, they shouldn't leave the lowermost space "open".

4. Is there a way to center horizontally the note names on the
corresponding notes, instead of left-aligning them? I believe that
would look better, especially the spacing between "fa" "sol" and "la"
looks awkward.

Thanks in advance for any help that you'll be willing to offer.

Gerardo

["note.ly" (text/x-lilypond)]

\version "2.22.0"

scala = \new GrandStaff \with {
    % draw staves as close as possible
    % if there's a way to make them even closer I didn't find it
    \override StaffGrouper.staff-staff-spacing.basic-distance = #0
  }
<<
  \new NoteNames {
    \set printNotesLanguage = "italiano"
    c d e f g a b | % ottava 1
    c d e f g a b | % ottava 2
    c d e f g a b | % ottava 3
    c d e f g a b | % ottava 4
    c d e f g a b | % ottava 5
    c d e f g a b | % ottava 6
    c               % ottava 7
  }
  \new Staff = "up" {
    \clef "treble"
    \omit Staff.TimeSignature
    \time 7/4
    \relative {
      s1..^\markup { \raise #8 \column { "Ottava 1" "la = 55 Hz" } }  |
      s1..^\markup { \raise #8 \column { "Ottava 2" "la = 110 Hz" } } |
      s1..^\markup { \raise #8 \column { "Ottava 3" "la = 220 Hz" } } |
      c'4^\markup { \raise #8 \column { "Ottava 4" "la = 440 Hz" } }
        d e f g a b |
      c^\markup { \raise #8 \column { "Ottava 5" "la = 880 Hz" } }
        d e f g a b |
      c^\markup { \raise #8 \column { "Ottava 6" "la = 1760 Hz" } }
        d e f g a b |
      c  % ottava 7
      s4 % a bit more space
    }
  }
  \new Staff = "down" {
    \clef "bass"
    \omit Staff.TimeSignature
    \relative {
      %\set Staff.ottavationMarkups = #ottavation-ordinals % unused
      c,, d e f g a b | % ottava 1
      c d e f g a b   | % ottava 2
      c d e f g a b   | % ottava 3
      s4*23             % ottava 4-7
    }
  }
>>

chiavi = \new GrandStaff
<<
  \new NoteNames {
    \set printNotesLanguage = "italiano"
    s1*3         | % spacing
    s8 g4 a b s8 | % basso
    s8 c4 d e s8 | % baritono
    s8 f4 g a s8 | % tenore
    s8 b4 c d s8 | % contralto
    s8 e4 f g s8 | % mezzosoprano
    s8 a4 b c s8 | % soprano
    s8 d4 e f s8 | % violino
  }
  \new Staff {
    \time 4/4
    \once \omit Staff.Clef
    \omit Staff.TimeSignature
    \relative c {
      \stopStaff
      s1*3 | % spacing
      \override Staff.Clef.full-size-change = ##t
      % bass clef
      \override Staff.StaffSymbol.line-positions = #'(-10 -8 -6 -4 -2)
      \startStaff
      s8
      \set Staff.clefGlyph = #"clefs.F"
      \set Staff.clefPosition = #-4
      \set Staff.middleCPosition = #0
      g4^\markup { \raise #7 "Basso" } a b s8 |
      \stopStaff
      % baritone clef
      \override Staff.StaffSymbol.line-positions = #'(-8 -6 -4 -2 0)
      \startStaff
      s8
      \set Staff.clefGlyph = #"clefs.C"
      \set Staff.clefPosition = #0
      \set Staff.middleCPosition = #0
      c4^\markup { \hspace #-2 \raise #6 "Baritono" } d e s8 |
      \stopStaff
      % tenor clef
      \override Staff.StaffSymbol.line-positions = #'(-6 -4 -2 0 2)
      \startStaff
      s8
      \set Staff.forceClef = ##t
      \set Staff.clefGlyph = #"clefs.C"
      \set Staff.clefPosition = #0
      \set Staff.middleCPosition = #0
      f4^\markup { \hspace #-2 \raise #5 "Tenore" } g \stemDown a s8 |
      \stopStaff
      % alto clef
      \override Staff.StaffSymbol.line-positions = #'(-4 -2 0 2 4)
      \startStaff
      s8
      \set Staff.forceClef = ##t
      \set Staff.clefGlyph = #"clefs.C"
      \set Staff.clefPosition = #0
      \set Staff.middleCPosition = #0
      \stemUp b4^\markup { \hspace #-4 \raise #4 "Contralto" }
        \stemDown c d s8 |
      \stopStaff
      % mezzosoprano clef
      \override Staff.StaffSymbol.line-positions = #'(-2 0 2 4 6)
      \startStaff
      s8
      \set Staff.forceClef = ##t
      \set Staff.clefGlyph = #"clefs.C"
      \set Staff.clefPosition = #0
      \set Staff.middleCPosition = #0
      e4^\markup { \hspace #-4 \raise #3 "Mezzosoprano" } f g s8 |
      \stopStaff
      % soprano clef
      \override Staff.StaffSymbol.line-positions = #'(0 2 4 6 8)
      \startStaff
      s8
      \set Staff.forceClef = ##t
      \set Staff.clefGlyph = #"clefs.C"
      \set Staff.clefPosition = #0
      \set Staff.middleCPosition = #0
      a4^\markup { \raise #2 "Soprano" } b c s8 |
      \stopStaff
      % treble clef
      \override Staff.StaffSymbol.line-positions = #'(2 4 6 8 10)
      \startStaff
      s8
      \set Staff.clefGlyph = #"clefs.G"
      \set Staff.clefPosition = #4
      \set Staff.middleCPosition = #0
      d4^\markup { \raise #1 "Violino" } e f s8 |
    }
  }
>>

\book{
  \header {
    tagline = ##f
  }
  \markup { \vspace #4 }
  \score {
    \scala
  }
  \markup { \vspace #4 }
  \score {
    \chiavi
  }
  \paper {
    #(set-paper-size "a4landscape")
    indent = 8\mm
  }
}

["note.pdf" (application/pdf)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic