On Wed, Jul 8, 2015 at 11:26 AM, Víctor [via Lilypond] <
ml-node+s1069038n17851...@n5.nabble.com> wrote:

> Abraham:
>
> You just gave me a wonderful solution, I'll explain myself:
>
> My current file layout is like this:
>
>
> *formato.ly <http://formato.ly>*
>
> \version "2.19.15"
>
> \include "snippets.ly"    % file with lots of snippets (really)
> \include "tipografia.ly"  % typographies
>
> \layout {
>     % some overrides here
> }
>
> % some format snippets here:
> formatoPerc = { \stemDown }
>
>
>
> *voice_with_piano_example.ly <http://voice_with_piano_example.ly>*
>
> \include "formato.ly"
>
> control { } % this normaly stays empty, but can be used to add code to the
> voice without "polluting" it
>
> voz = { a4 b c }
> verso = \lyricmode { la la la }
>
> pianoDer = { a4 b c }
> pianoIzq = {a4 b c }
>
> dinamicas = { s4\pp s4 s4\f } % some dynamics here
>
> \score {
>   <<
>     \new Staff \with { instrumentName = \vozSolo } << % this variable is
> defined in *formato.ly <http://formato.ly>*
>       \new Voice \voz
>       \addlyrics \verso
>       \new Voice \control
>     >>
>     \new PianoStaff \with { instrumentName = \pianoIns } <<
>       \new Staff = "MD" <<
>         \new Voice \pianoDer
>         \new Dynamics \dinamicas
>       >>
>       \new Staff = "MI" {
>         \clef bass
>         \pianoIzq
>       }
>     >>
>   >>
> }
>
> But now I've realized that \score should be declared in a separate file,
> something like* voz_y_piano.ly <http://voz_y_piano.ly>*, and there I can
> easely comment out the piano staff for all my files at once, avoiding both
> pain and human mistakes.
>
> Thanks again to all of you for your support. Best regards,
> Víctor.
>


Glad I could offer some help! Yes, if the \score block is the same for each
song, then putting it in its own file and \include-ing it after the
variable definitions is a handy way to solve this problem, for reasons
you've already discovered.

Also, I don't know if it makes a difference to you (it appears the output
doesn't change), but I'd move your Dynamic section more explicitly
in-between the two piano staves. I think it just makes the code a little
cleaner. Like this:

\new PianoStaff <<
  \new Staff ...
  \new Dynamics ...
  \new Staff ...
>>

Oh, and you don't need to explicitly create a \new Voice anymore in the
upper piano Staff if you do that. Just a small suggestion.

- Abraham




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Switching-on-off-instrument-staff-tp178484p178517.html
Sent from the User mailing list archive at Nabble.com.
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to