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 18:31:13 +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

Hello again,

I compiled your example, but it didn't compile without errors. I did get the results you got, however.

I changed your code to obtain what I expected your code to produce:

======================
%{
        Example of variable stafftype with scheme funtions
%}

\version "2.13.32"

makeFor = #'piano
%makeFor = #'choir

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

%#(define upperStaff (if (eq? makeFor 'choir)
%                        "Staff"
%                        "Devnull"))
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
    {
        \set Staff.instrumentName = \myContainer
        <<
      \upperMelody
        >>
        }
    \new Staff {
      \lowerMelody
    }
  >>
}
======================

By setting the instrumentName to \myContainer I checked what was actually happening. In your example an unrecoverable error occurred. The above example is bug-free in the \version used.

I'll try to work this to a code for omitting the tablature staff, and post it here.

--Marten



reply via email to

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