lilypond-user
[Top][All Lists]
Advanced

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

Re: (no subject) (fwd)


From: Mats Bengtsson
Subject: Re: (no subject) (fwd)
Date: Tue, 04 Dec 2001 17:41:56 +0100

> ...

> I assume that you want completely empty staves; let's say you are a music 
> teacher and for some exercise you want to prepare a piece of score with 
> some of the staves already filled in with music, others completely empty: 
> no bars, no clefs, no times signatures. The students have to fill that in.
> 
> Since the other staves need to behave normally, you cannot just modify the 
> Staff context like ...
> 
> \paper {
>       \translator {
>               \StaffContext
>                       \remove Bar_engraver
>                       \remove Time_signature_engraver
>                       \remove Clef_engraver
>       }
> }
> 
> ... because that will kill the music in the other staves as well. So what 
> you want is a your own new staff context. In principle this should be 
> covered in the manual. I looked at:
> http://www.lilypond.org/development/Documentation/user/out-www/lilypond/Defining-new-contexts.html
> which should be the complete HOWTO for new context creation but I failed. 
> I tried empty1.ly and empty2.ly (attachments 2 and 3) and tons of 
> obvious variations but all of them only give me an error: "warning: can't 
> find or create `EmptyStaffContext' called `bar'" and the result looks 
> identical to that of empty0.ly (probably because it defaults to normal 
> Staff context).
> 
> So even though your question sounded like a FAQ I can not help you. I
> searched the online manual and I have been grepping in the ly/ and
> input/regression/ directories but that did not provide me with working
> ideas. So it's time for a higher ranked guru to step in. If he succeeds in
> explaining me what I did wrong when I tried to create this EmptyStaff
> context I will probably transform that into improvement suggestions for
> the above-mentioned manualpage.


The following modified version of your example works well, 
as far as I can see:

\paper {
        \translator{
                \ScoreContext
                \accepts "EmptyStaff"
        }
        \translator  {
                \type "Engraver_group_engraver"
                \name "EmptyStaff"
                \consists "Staff_symbol_engraver"
                \consistsend "Axis_group_engraver"
                MinimumVerticalExtent = #'(-4 . 4)
        }
}

\score{
<
        \context Staff = "foo" \notes { c'4 d' e' f' | g' f' e' d' }
        \context EmptyStaff = "bar" \notes { s1 | s1 }
        \context Staff = "baz" \notes { g'4 f' e' d' | c' d' e' f' }
>
}

The trick is you have to include the new context type into the
context hierarchy, by adding an \accepts statement to the 
default Score context translator. If you want to use the new
type of contexts in a StaffGroup, for example, you should add
the \accepts statement to the \StaffGroupContext translator.

I first thought that it would be enough to add an \alias "Staff"
to the EmptyStaff translator but it didn't work. I found a comment
in the source code of Translator_def::path_to_acceptable_translator
that probably explains why.

   /Mats





reply via email to

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