lilypond-user
[Top][All Lists]
Advanced

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

Re: Re: Re: conditional formatting


From: Marten Visser
Subject: Re: Re: Re: conditional formatting
Date: Tue, 05 Oct 2010 19:07:55 +0200

At 11:08 05/10/2010, you wrote:
On Mon 04 Oct 2010, 23:11 Marten Visser wrote:
> Dmytro's suggestion looks more promising, though I haven't been able
> to generate code that does the job so far. When I code
>
> ==================
> \new Devnull
> <<
>         \TablatureNotes
> >>
> ==================
>
> I still get an empty tabStaff and two tabstaffs below it for both
> voices in the \TablatureNotes. Replacing "Devnull" by "TabStaff", I
> get one tabstaff with both voices combined. I guess Devnull is not a
> manner to suppress printing the staff.

Sorry, i've not tested this much.

Which lilypond version do you use? That sample was tested (a bit,-) with
2.13.35, latest development so far. Well.. this works with 2.12 too, ive tried
just now.

First of all -- i'm not sure that this is the best (or even smart at all) way
to do "this" (and i am still not sure that i understood what's needed,-)

Anyway, please take a look -- this example produces ChoirStaff with two staves
if makeFor equals 'choir and produces single staff with \lowerMelody if
makeFor equals anything else.

How far this from a required result?

%--------------8<-----------------------
makeFor = #'choir

#(define myContainer (if (eq? makeFor 'choir)
                         "ChoirStaff"
                         "Devnull"))

#(define upperStaff (if (eq? makeFor 'choir)
                        "Staff"
                        "Devnull"))

upperMelody = \relative c'' {
  c4 bes d c
}

lowerMelody = \relative c'' {
  a4 g bes a
}

\score {
  \new \myContainer <<
    \new \upperStaff <<
      \upperMelody
    >>
    \new Staff {
      \lowerMelody
    }
  >>
}
%--------------8<-----------------------

I'm just interesting .-)

Playing with lilypond gives me a lot of fun and some experience, which can be
used later, for my own needs.

Or, if this is more convenient for you, could you post a small example ---
what you've tried and it wasn't work as desired?

Thanks.

--
  Dmytro O. Redchuk
  Bug Squad


Ah, sooner than expected: I guess there's a bug or oddity in the TabStaff. Please check out the behaviour of the example below:

typesetting for guitar now goes allright, but for piano and choir it yields the undesired tabstaffs (three of them!). These don't disappear into the Devnull, although Devnull has been defined.

Check the attached files to see the output for guitar (as expected) and choir (not as expected).

Thanks for looking,
--Marten

=======================
%{
        Example of optional TabStaff with scheme functions
%}

\version "2.13.32"

makeFor = #'piano
%makeFor = #'choir
makeFor = #'guitar

myContainer =
        #(if (eq? makeFor 'choir) "ChoirStaff" "PianoStaff")

upperStaff =
        #(if (eq? makeFor 'choir) "Staff" "Devnull")

OptionalTabStaff =
        #(if (eq? makeFor 'guitar) "TabStaff" "Devnull")



upperMelody = \relative c'' {
  c4 bes d c
}

lowerMelody = \relative c'' {
  a4 g bes a
}

Tablature = \simultaneous { % Combine both voices for Tablature
        \override TabStaff.Stem #'transparent = ##t % Makes stems transparent
        \override TabStaff.Beam #'transparent = ##t % Makes beams transparent
        << \context TabVoice=TabVoiceA { \upperMelody} >>
        << \context TabVoice=TabVoiceB { \lowerMelody} >>
        }


\score {
  <<
        \new \myContainer <<
        \new \upperStaff
        {
                \set Staff.instrumentName = \myContainer
                <<
            \upperMelody
                >>
                }
          \new Staff {
          \lowerMelody
            }
        >>
                \new \OptionalTabStaff <<
        \set TabStaff.instrumentName = \OptionalTabStaff
                        \Tablature
                >>
        >>
}
=======================

Attachment: optional tabStaff - guitar.pdf
Description: Adobe PDF document

Attachment: optional tabStaff - choir.pdf
Description: Adobe PDF document


reply via email to

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