Re: Allow music with layout instructions in output definitions. (issue 5701049)

2013-09-05 Thread lemniskata . bernoullego

Hi,

(some archeology...)

On 2012/02/29 23:44:20, dak wrote:

Janek Warchoł  writes:



> On Wed, Feb 29, 2012 at 9:22 AM, David Kastrup 

wrote:

>> Janek Warchoł  writes:
>>>
>>> sure, i can do this.  Nevertheless, writing these in \layout

{} would

>>> be more elegant
>>
>> No.  An arbitrary number of named contexts can occur in the

text, and

>> some are implicitly named anyway.  So you want to change _all_

contexts

>> of a given type in \layout and/or derive a new context type

(aaVoice or

>> so) and then use \new aaVoice ... in the score.
>>
>>> and in my opinion easier to maintain: \layout must be placed at

the

>>> end of \score block, while variables containing context

modifications

>>> must be defined before they are used, i.e. before \score block.

 Thus,

>>> style decisions are spread over two places.
>>
>> A _style_ is something affecting _all_ contexts of a given type,

not

>> just particular contexts with a particular id.
>
> Hmm.  I'm not sure if i understand what you mean.  Let me give an
> example case where i think that named context thingy would be

useful:

> i have a piece for 3 SATB choirs; the structure is
>
> \score { <<
>   \new ChoirStaff = ChoirOne <<
> \new Staff = soprano { }
> \new Staff = alto { }
> \new Staff = tenor { }
> \new Staff = bass { }
>   >>
>   \new ChoirStaff = ChoirTwo <<
> \new Staff = soprano { }
> \new Staff = alto { }
> \new Staff = tenor { }
> \new Staff = bass { }
>   >>
>   \new ChoirStaff = ChoirThree <<
> \new Staff = soprano { }
> \new Staff = alto { }
> \new Staff = tenor { }
> \new Staff = bass { }
>   >>
>>>
>
> i'll print scores separately for each choir, so to save space i can
> make two choirStaves smaller in each print.



Then make a SmallStaff context definition and use it instead of Staff.
Take a look at engraver-init.ly for examples.  I think that
RhythmicStaff is created from Staff, for example.


Being a more experienced LilyPond user now, i can say that you were
right.  Creating custom contexts *is* the way to do this.  The remaining
question is whether creating custom contexts can be done easily enough
(i had serious trouble last time when i attempted doing this), and
whether some other structural shortcomings can be fixed.

best,
Janek

https://codereview.appspot.com/5701049/
___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Allow music with layout instructions in output definitions. (issue 5701049)

2012-02-29 Thread David Kastrup
Janek Warchoł  writes:

> On Wed, Feb 29, 2012 at 9:22 AM, David Kastrup  wrote:
>> Janek Warchoł  writes:
>>>
>>> sure, i can do this.  Nevertheless, writing these in \layout {} would
>>> be more elegant
>>
>> No.  An arbitrary number of named contexts can occur in the text, and
>> some are implicitly named anyway.  So you want to change _all_ contexts
>> of a given type in \layout and/or derive a new context type (aaVoice or
>> so) and then use \new aaVoice ... in the score.
>>
>>> and in my opinion easier to maintain: \layout must be placed at the
>>> end of \score block, while variables containing context modifications
>>> must be defined before they are used, i.e. before \score block.  Thus,
>>> style decisions are spread over two places.
>>
>> A _style_ is something affecting _all_ contexts of a given type, not
>> just particular contexts with a particular id.
>
> Hmm.  I'm not sure if i understand what you mean.  Let me give an
> example case where i think that named context thingy would be useful:
> i have a piece for 3 SATB choirs; the structure is
>
> \score { <<
>   \new ChoirStaff = ChoirOne <<
> \new Staff = soprano { }
> \new Staff = alto { }
> \new Staff = tenor { }
> \new Staff = bass { }
>   >>
>   \new ChoirStaff = ChoirTwo <<
> \new Staff = soprano { }
> \new Staff = alto { }
> \new Staff = tenor { }
> \new Staff = bass { }
>   >>
>   \new ChoirStaff = ChoirThree <<
> \new Staff = soprano { }
> \new Staff = alto { }
> \new Staff = tenor { }
> \new Staff = bass { }
>   >>
>>>
>
> i'll print scores separately for each choir, so to save space i can
> make two choirStaves smaller in each print.

Then make a SmallStaff context definition and use it instead of Staff.
Take a look at engraver-init.ly for examples.  I think that
RhythmicStaff is created from Staff, for example.

-- 
David Kastrup

___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Allow music with layout instructions in output definitions. (issue 5701049)

2012-02-29 Thread Janek Warchoł
On Wed, Feb 29, 2012 at 9:22 AM, David Kastrup  wrote:
> Janek Warchoł  writes:
>
>>> Contextmodifications can be placed in variables, so you can write
>>>
>>> aasettings = \with { ... }
>>>
>>> and later use
>>>
>>> \new Voice = aa \aasettings { ... }
>>>
>>> or
>>>
>>> \new Voice = aa \with \aasettings { ... }
>>
>> sure, i can do this.  Nevertheless, writing these in \layout {} would
>> be more elegant
>
> No.  An arbitrary number of named contexts can occur in the text, and
> some are implicitly named anyway.  So you want to change _all_ contexts
> of a given type in \layout and/or derive a new context type (aaVoice or
> so) and then use \new aaVoice ... in the score.
>
>> and in my opinion easier to maintain: \layout must be placed at the
>> end of \score block, while variables containing context modifications
>> must be defined before they are used, i.e. before \score block.  Thus,
>> style decisions are spread over two places.
>
> A _style_ is something affecting _all_ contexts of a given type, not
> just particular contexts with a particular id.

Hmm.  I'm not sure if i understand what you mean.  Let me give an
example case where i think that named context thingy would be useful:
i have a piece for 3 SATB choirs; the structure is

\score { <<
  \new ChoirStaff = ChoirOne <<
\new Staff = soprano { }
\new Staff = alto { }
\new Staff = tenor { }
\new Staff = bass { }
  >>
  \new ChoirStaff = ChoirTwo <<
\new Staff = soprano { }
\new Staff = alto { }
\new Staff = tenor { }
\new Staff = bass { }
  >>
  \new ChoirStaff = ChoirThree <<
\new Staff = soprano { }
\new Staff = alto { }
\new Staff = tenor { }
\new Staff = bass { }
  >>
>>

i'll print scores separately for each choir, so to save space i can
make two choirStaves smaller in each print.  In other words, first
choir will get a score with regularly sized ChoirOne and smaller
ChoirTwo and ChoirThree, and so on.  I would find it handy if i could
write
\layout {
  \override ChoirTwo.StaffSymbol #'size = -3
  \override ChoirThree.StaffSymbol #'size = -3
}
to achieve this.
Also, in my opinion it would be nice if i could use
\layout {
  \override soprano.StaffSymbol #'thickness = 2
}
to make all soprano staffs thicker.  I could then very easily change
it to make all alto staffs thicker, and so on.
I don't insist that LilyPond should work this way; i'm only saying
that i'd find it intuitive and useful.

> And of course you can to
>
> mylayout = \layout { ... }
>
> at the top and then use it as a layout definition afterwards.

That's nice, i didn't think about it. Thanks!
Janek

___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Allow music with layout instructions in output definitions. (issue 5701049)

2012-02-29 Thread David Kastrup
Janek Warchoł  writes:

>> Contextmodifications can be placed in variables, so you can write
>>
>> aasettings = \with { ... }
>>
>> and later use
>>
>> \new Voice = aa \aasettings { ... }
>>
>> or
>>
>> \new Voice = aa \with \aasettings { ... }
>
> sure, i can do this.  Nevertheless, writing these in \layout {} would
> be more elegant

No.  An arbitrary number of named contexts can occur in the text, and
some are implicitly named anyway.  So you want to change _all_ contexts
of a given type in \layout and/or derive a new context type (aaVoice or
so) and then use \new aaVoice ... in the score.

> and in my opinion easier to maintain: \layout must be placed at the
> end of \score block, while variables containing context modifications
> must be defined before they are used, i.e. before \score block.  Thus,
> style decisions are spread over two places.

A _style_ is something affecting _all_ contexts of a given type, not
just particular contexts with a particular id.

And of course you can to

mylayout = \layout { ... }

at the top and then use it as a layout definition afterwards.

> still, your work is great!


-- 
David Kastrup

___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Allow music with layout instructions in output definitions. (issue 5701049)

2012-02-28 Thread Janek Warchoł
On Tue, Feb 28, 2012 at 9:27 AM, David Kastrup  wrote:
> Janek Warchoł  writes:
 I even hoped that something like this will be possible:
 \score { <<
     \new Voice { b b }
     \new Voice = "aa" { b b }
   >>
   \layout { \override aa.NoteHead #'color = #red }
 }
>>>
>>> It is nonsense since aa is not the type but the id of a context and
>>> can't be meddled with in a layout definition.
>>
>> ok...
>> Out of curiosity, would this be possible to add in a reasonable way or
>> is it totally wrong?
>
> Totally wrong.

Pity.  It would be very useful.

>> From a users' perspective, it would be great to have such overrides in
>> \layout, because then i'd have 3 separate and independent areas of my
>> file: - music in variables or \include files - style decisions in
>> \layout block.  - score structure that doesn't contain any of the
>> above and can be freely changed.
>
> You can use context modifications for that.

Hmm?  If i try

\score { <<
\new Voice { b b }
\new Voice = "aa" { b b }
  >>
  \layout {
\context {
   \Voice = "aa"
   \override NoteHead #'color = #red
 }
   }
}

i get a syntax error.
Maybe i misunderstood you.

>> \score {
>>     \new Voice \with { \settingsFrom \override NoteHead #'color = #red } { b 
>> b }
>>   }
>>
>> produces
>>
>> ../bah.ly:2:37: error: syntax error, unexpected \override
>>     \new Voice \with { \settingsFrom
>>                                      \override NoteHead #'color = #red } { b 
>> b }
>
> Ah yes.  Because \settingsFrom has an optional argument, and so the
> music argument must be some delimited form if the optional argument is
> left out.  At one point of time, this aggravation will go, but I will
> need to boil down the grammar a bit more before I can manage that.

ok

> Well, I _did_ write "Totally elusive bug that also afflicted
> \settingsFrom.  Fixed."
>
> So it is to be expected that you need to update to the very latest git
> commit first.

Aah, fixed in git.  I thought it was fixed in the new patchset.

> Contextmodifications can be placed in variables, so you can write
>
> aasettings = \with { ... }
>
> and later use
>
> \new Voice = aa \aasettings { ... }
>
> or
>
> \new Voice = aa \with \aasettings { ... }

sure, i can do this.  Nevertheless, writing these in \layout {} would
be more elegant and in my opinion easier to maintain: \layout must be
placed at the end of \score block, while variables containing context
modifications must be defined before they are used, i.e. before \score
block.  Thus, style decisions are spread over two places.

still, your work is great!
Janek

___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Allow music with layout instructions in output definitions. (issue 5701049)

2012-02-28 Thread David Kastrup
Janek Warchoł  writes:

> On Tue, Feb 28, 2012 at 2:36 AM,   wrote:
>>> \score {
>>>   \new Staff { b b }
>>>   \layout { \override NoteHead #'color = #red }
>>> }
>>
>> Totally elusive bug that also afflicted \settingsFrom.  Fixed
>
> i confirm that it works for me.  Thanks!
>
>>> I even hoped that something like this will be possible:
>>> \score { <<
>>>     \new Voice { b b }
>>>     \new Voice = "aa" { b b }
>>>   >>
>>>   \layout { \override aa.NoteHead #'color = #red }
>>> }
>>
>> It is nonsense since aa is not the type but the id of a context and
>> can't be meddled with in a layout definition.
>
> ok...
> Out of curiosity, would this be possible to add in a reasonable way or
> is it totally wrong?

Totally wrong.

> From a users' perspective, it would be great to have such overrides in
> \layout, because then i'd have 3 separate and independent areas of my
> file: - music in variables or \include files - style decisions in
> \layout block.  - score structure that doesn't contain any of the
> above and can be freely changed.

You can use context modifications for that.

>> Try \new Voice = "aa" \with { \settingsFrom \override NoteHead #'color
>> #red } { ...
>> instead.
>
> It doesn't work:
>
> \score {
> \new Voice \with { \settingsFrom \override NoteHead #'color = #red } { b 
> b }
>   }
>
> produces
>
> ../bah.ly:2:37: error: syntax error, unexpected \override
> \new Voice \with { \settingsFrom
>  \override NoteHead #'color = #red } { b 
> b }

Ah yes.  Because \settingsFrom has an optional argument, and so the
music argument must be some delimited form if the optional argument is
left out.  At one point of time, this aggravation will go, but I will
need to boil down the grammar a bit more before I can manage that.

> If i add a pair of curly braces, i.e.
> \score {
>   \new Voice \with { \settingsFrom { \override NoteHead #'color = #red
> } } { b b }
>   }
>
> then it compiles, but the override isn't applied.

Well, I _did_ write "Totally elusive bug that also afflicted
\settingsFrom.  Fixed."

So it is to be expected that you need to update to the very latest git
commit first.

Contextmodifications can be placed in variables, so you can write

aasettings = \with { ... }


and later use

\new Voice = aa \aasettings { ... }

or

\new Voice = aa \with \aasettings { ... }

-- 
David Kastrup

___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Allow music with layout instructions in output definitions. (issue 5701049)

2012-02-27 Thread Janek Warchoł
On Tue, Feb 28, 2012 at 2:36 AM,   wrote:
>> \score {
>>   \new Staff { b b }
>>   \layout { \override NoteHead #'color = #red }
>> }
>
> Totally elusive bug that also afflicted \settingsFrom.  Fixed

i confirm that it works for me.  Thanks!

>> I even hoped that something like this will be possible:
>> \score { <<
>>     \new Voice { b b }
>>     \new Voice = "aa" { b b }
>>   >>
>>   \layout { \override aa.NoteHead #'color = #red }
>> }
>
> It is nonsense since aa is not the type but the id of a context and
> can't be meddled with in a layout definition.

ok...
Out of curiosity, would this be possible to add in a reasonable way or
is it totally wrong?  From a users' perspective, it would be great to
have such overrides in \layout, because then i'd have 3 separate and
independent areas of my file:
- music in variables or \include files
- style decisions in \layout block.
- score structure that doesn't contain any of the above and can be
freely changed.

> Try \new Voice = "aa" \with { \settingsFrom \override NoteHead #'color
> #red } { ...
> instead.

It doesn't work:

\score {
\new Voice \with { \settingsFrom \override NoteHead #'color = #red } { b b }
  }

produces

../bah.ly:2:37: error: syntax error, unexpected \override
\new Voice \with { \settingsFrom
 \override NoteHead #'color = #red } { b b }

If i add a pair of curly braces, i.e.
\score {
  \new Voice \with { \settingsFrom { \override NoteHead #'color = #red
} } { b b }
  }

then it compiles, but the override isn't applied.

HTH,
Janek

___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Allow music with layout instructions in output definitions. (issue 5701049)

2012-02-27 Thread dak

Reviewers: janek,

Message:
On 2012/02/27 22:23:15, janek wrote:


However, the following example doesn't work (it doesn't produce any

warning,

either):



\score {
   \new Staff { b b }
   \layout { \override NoteHead #'color = #red }
}



Is this intended?  I hoped that it would be possible to do this.


Totally elusive bug that also afflicted \settingsFrom.  Fixed


I even hoped that something like this will be possible:



\score { <<
 \new Voice { b b }
 \new Voice = "aa" { b b }
   >>
   \layout { \override aa.NoteHead #'color = #red }
}



but the results are strange: not only does it not compile, but it

gives an

unusual error:


It is nonsense since aa is not the type but the id of a context and
can't be meddled with in a layout definition.

Try \new Voice = "aa" \with { \settingsFrom \override NoteHead #'color
#red } { ...
instead.

The code for the warning was, however, malformed.  Fixed.

Description:
Allow music with layout instructions in output definitions.

This allows things like

  \layout { \accidentalStyle modern }

or

  \midi { \tempo 4 = 80 }

to work as intended.

Please review this at http://codereview.appspot.com/5701049/

Affected files:
  M lily/context-def.cc
  M lily/include/context-def.hh
  M lily/parser.yy
  M ly/declarations-init.ly
  M scm/lily-library.scm



___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Allow music with layout instructions in output definitions. (issue 5701049)

2012-02-27 Thread janek . lilypond

David,

this is 300% awesome!!
However, the following example doesn't work (it doesn't produce any
warning, either):

\score {
  \new Staff { b b }
  \layout { \override NoteHead #'color = #red }
}

Is this intended?  I hoped that it would be possible to do this.
I even hoped that something like this will be possible:

\score { <<
\new Voice { b b }
\new Voice = "aa" { b b }
  >>
  \layout { \override aa.NoteHead #'color = #red }
}

but the results are strange: not only does it not compile, but it gives
an unusual error:

GNU LilyPond 2.15.31
Processing `../advanc.ly'
Parsing.../home/janek/lilypond-git/build/out/share/lilypond/current/scm/lily-library.scm:314:40:
In expression (_f "Cannot find context-def \\~a" sym):
/home/janek/lilypond-git/build/out/share/lilypond/current/scm/lily-library.scm:314:40:
Unbound variable: _f

Also, it fails to compile next .ly file in queue (when i tried
processing these files with 2.15.26, advanc.ly failed but other files
were compiled).

HTH,
Janek

http://codereview.appspot.com/5701049/

___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel