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

List:       lilypond-user
Subject:    Re: A question regarding staff crossing
From:       Mats Bengtsson <mats.bengtsson () ee ! kth ! se>
Date:       2006-08-30 8:21:46
Message-ID: 44F54A9A.60006 () ee ! kth ! se
[Download RAW message or body]

One solution is to introduce a separate variable that
handles the staff switching (and changing stem directions).
As long as it ends up in the same Voice context as the
corresponding music, it will work well. I modified the following
lines in your example to do it:

rhUpper = \relative c''' { \Key c4 g a b | c1 }
rhLower = \relative c'' { \Key c2 c4 d | e1 }
lhUpper = \relative c' { \Key c1 | c'4 g e g | }
lhLower = \relative c { \Key c1 | c }

switchVoiceThree = { s1 \change Staff = up \voiceFour }

...

piano = {
  \context PianoStaff <<
    \set PianoStaff.instrument = #"Piano   "
    \set PianoStaff.instr = #"p   "
    \context Staff = up {  
      \clef treble
      \global
      \set Staff.midiInstrument = "acoustic grand"
      << \rhUpper \\ \rhLower >>
    }
    \context Staff = down {
      \clef bass
      \global
      \set Staff.midiInstrument = "acoustic grand"
      << << \lhUpper \switchVoiceThree >> \\ \lhLower >>
    }
  >>
}


Note also that I used the <<{...} \\ {...} >> construct to
save some typing. Read in "Explicitly instantiating voices"
for more information on exactly what it does.

Finally, I would recommend you to upgrade to the latest
stable version of LilyPond, version 2.8.6. It's available for
download at www.lilypond.org in the form of a package
that installs easily on any Linux distribution.
In addition to the new features and bug fixes, it also
contains a significantly improved manual (in fact, the
manual for version 2.9 is even better and applies almost
completely also to version 2.8).

   /Mats

Amelie Zapf wrote:

>Dear Lilypond folks,
>
>after a long period of "not having any questions" and happily using 2.0, I've 
>now upgraded to 2.6.5, due to Linux distribution upgrade. Now here's what I'd 
>like to do:
>
>I have a score with the format attached below. Now I would like to use manual 
>staff switches in the piano, while still keeping layout and content nicely 
>separated, i.e. I'd like to retain the four piano voices as separate units, 
>but each one in one piece, and insert them into the PianoStaff later on. Is 
>there any way to do that?
>
>Regards,
>
>Amy
>
>%%% The Score
>
>#(set-default-paper-size "a4")
>#(set-global-staff-size 16)
>\include "english.ly"
>%%%%%%%%%%%% Keys'n'thangs %%%%%%%%%%%%%%%%%   
>global = { \time 4/4 }
>Key = { \key c \major }
>
>% ############ Chords ###########
>
>harmony = \chordmode { \jzchords c1 }
>     
>% ############ VOICES ############
>
>voc = \relative c' { \Key c1}
>text = \lyricmode { note }
>    
>flt = \relative c'' { \Key }
>
>rhUpper = \relative c''' { \voiceOne \Key c1 }
>rhLower = \relative c'' { \voiceTwo \Key c1 }
>lhUpper = \relative c' { \voiceOne \Key c1 \change Staff = up c'1 }
>lhLower = \relative c' { \voiceTwo \Key c1 }
>    
>Bass = \transpose c c' \relative c, { \Key c1 }
>drumset = \drummode { bd4 }
>     
>%%%%%%%%% PRE-PROCESSING THE VOICES %%%%%%%%%%%%%%%%%%%%%%
>
>%% ----- Chords -----
>
>rsharmony = \harmony
>% tenorharmony = \transpose c' d \harmony
>
>%% ----- Instruments -----
>
>vocal = {
>  \global
>  \set Staff.instrument = #"Mezzo-Soprano"
>  \set Staff.instr = #"msop"
>  \set Staff.midiInstrument = "violin"
>  \clef treble
>  \context Voice = theVoice \voc
>}
>
>flute = {
>  \global
>  \set Staff.instrument = #"Flute"
>  \set Staff.instr = #"fl"
>  \set Staff.midiInstrument = "flute"
>  \clef treble
>  \context Staff \flt
>}
>
>piano = {
>  \context PianoStaff <<
>    \set PianoStaff.instrument = #"Piano   "
>    \set PianoStaff.instr = #"p   "
>    \context Staff = up {   
>      \clef treble
>      \global
>      \set Staff.midiInstrument = "acoustic grand"
>      << \new Voice \rhUpper \new Voice \rhLower >>
>    }
>    \context Staff = down {
>      \clef bass
>      \global
>      \set Staff.midiInstrument = "acoustic grand"
>      << \new Voice \lhUpper \new Voice \lhLower >>
>    }
>  >>
>}
>
>bass = {
>  \global
>  \set Staff.instrument = #"Bass"
>  \set Staff.instr = #"b"
>  \set Staff.midiInstrument = "contrabass"
>  \clef bass
>  \context Staff \Bass
>}
>
>drumContents = {
>  \global
>  <<
>    \set DrumStaff.instrument = #"Drums"
>    \set DrumStaff.instr = #"dr"
>    \new DrumVoice \drumset
>  >>
>}
>     
>%%%%%%%%% It All Goes Together Here %%%%%%%%%%%%%%%%%%%%%%
>     
>\score {
>  <<
>    \new Staff \vocal
>    \lyricsto "theVoice" \new Lyrics \text
>    \new Staff \flute
>    \new ChordNames \rsharmony
>    \new PianoStaff \piano
>    \new Staff \bass
>    \new DrumStaff { \drumContents }
>  >>
>   
>  \layout {
>    indent = 1.5 \cm
>    raggedlast = ##t
>    \context { \RemoveEmptyStaffContext }
>    \context {
>      \Score
>      \override BarNumber #'padding = #3
>      \override RehearsalMark #'padding = #2
>      skipBars = ##t
>    }
>  }
> 
>  \midi { \tempo 4 = 80 }
>}
>
>\paper {
>    % vsize = 29.7 \cm
>    % hsize = 21.0 \cm
>    linewidth = 17.0 \cm
>    topmargin = 2.0 \cm
>    bottommargin = 2.0 \cm
>    leftmargin = 2.0 \cm
>    betweensystempadding = #1
>    raggedbottom=##f
>    raggedlastbottom=##f
>    % systemSeparatorMarkup=\slashSeparator
>}
>
>  
>


-- 
=============================================
	Mats Bengtsson
	Signal Processing
	Signals, Sensors and Systems
	Royal Institute of Technology
	SE-100 44  STOCKHOLM
	Sweden
	Phone: (+46) 8 790 8463				
        Fax:   (+46) 8 790 7260
	Email: mats.bengtsson@ee.kth.se
	WWW: http://www.s3.kth.se/~mabe
=============================================




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

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