lilypond-user
[Top][All Lists]
Advanced

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

Working example of clef change in the beginning on piece


From: Pavel Roskin
Subject: Working example of clef change in the beginning on piece
Date: Fri, 13 Jan 2012 18:35:39 -0500

Hello!

I asked recently how to change clef in the beginning of the piece.  I  
got some replies privately.  I also found several different  
suggestions online.

I spent quite a lot of time testing all suggestions and came to an  
approach that produces beautiful PDF output and has almost no effect on
the MIDI output.  The only downside is that all staves need to be
modified.

I'm posting this example to get comments if anything could be done
better.  If I don't get any suggestions, I'll try to submit this file
to the snippets repository.

\version "2.14.2"

VoiceOne = \relative c'' {
  \partial 8 s8 |
  c8 d e
}

VoiceTwo = \relative c' {
  \clef bass
  % Force clef change in the first measure
  \once \override Rest #'X-extent = #'(0 . 0)
  \once \override Rest #'stencil = ##f
  \partial 8 r8 \bar "" \clef treble |
  c8 d e
}

\score {
  <<
    \new Staff \VoiceOne
    \new Staff \VoiceTwo
  >>
  \layout {}
}


I wish I could use \grace, but it causes a warning: "Going back in MIDI
time".  It looks like Lilypond wants to borrow some time from the
previous note, but there is none.

Moreover, the same happens for \appoggiatura, which is plain wrong, as
it must take time from the subsequent note only.  That's issue 1412.

I could avoid \partial, but I would need to renumber bars.  Also, the
pause before the first note would be longer.

Fortunately, with r128 the pause is so short that MIDI import
software ignores it (tested on nted).  Not so with longer rests.  I wish
I could suppress all MIDI output from the first measure but I could not
find how to do that.  Using Score.skipTypesetting would suppress the
clef change in the PDF as well.  So there is a very short rest in the
beginning of the MIDI file.  

I had to use the real rest in the staff where the clef change is
needed.  There seems to be no way to manipulate spacial properties of
the silent rest.  So I make the rest transparent by setting stencil
and override X-extent to make it as thin as possible.

Maybe there is a way to reserve horizontal space on the staff without
reserving any duration? Then I could use a silent rest plus the "staff
spacer" without hiding anything.

The rendered output is attached.

-- 
Regards,
Pavel Roskin

Attachment: clef_change.png
Description: PNG image


reply via email to

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