Re: include puzzlement

2017-12-29 Thread David Kastrup
Shane Brandes  writes:

> Thanks all, and Kieran that pattern will definitely work for future
> projects. Unfortunately that leaves me with unwinding, separating the
> music from the score definitions,  200 some such files for a current
> one to get it to work. I had anticipated that the whole bookpart thing
> simply encapsulated that bit of information in its own little section
> and would therefore work. That probably has to do with the idea that
> some years ago I used to simply copy each piece in line together and
> they would merrily create themselves then at some point the code
> operating the headers was change such that that no longer worked. I
> thought the whole bookpart was added to restore such functionality,
> but the underlying mechanism is oddly different and it must be to do
> with with who the lilypond does business and since I have learned
> anything other than basic and python not much beyond how it functions
> not that I could code my way out of a paper bag.

Frankly, talking your way out of a paper bag seems like a challenge
right now, too.  All this verbiage appears to indicate that LilyPond
changed for the worse at some point of time for your use pattern, but I
cannot make head nor tails of it.

-- 
David Kastrup

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


Re: include puzzlement

2017-12-29 Thread Shane Brandes
Thanks all, and Kieran that pattern will definitely work for future
projects. Unfortunately that leaves me with unwinding, separating the
music from the score definitions,  200 some such files for a current
one to get it to work. I had anticipated that the whole bookpart thing
simply encapsulated that bit of information in its own little section
and would therefore work. That probably has to do with the idea that
some years ago I used to simply copy each piece in line together and
they would merrily create themselves then at some point the code
operating the headers was change such that that no longer worked. I
thought the whole bookpart was added to restore such functionality,
but the underlying mechanism is oddly different and it must be to do
with with who the lilypond does business and since I have learned
anything other than basic and python not much beyond how it functions
not that I could code my way out of a paper bag. So David is probably
right in that I believed that each bookpart had its own scope, however
that is not a programming term I am familiar with.

regards,
Shane

On Fri, Dec 29, 2017 at 2:59 PM, David Kastrup  wrote:
> Shane Brandes  writes:
>
>> o.k. back to the include with book part problem. Here is my almost
>> minimal code example, which consists of files a.ly, b.ly and test.ly.
>> The two files compile alone correctly but when stuck in the bookpart
>> they go to pieces.
>
> Sigh.  Your original complaint was:
>
> O.k. having gone in circles trying to figure out the whole bookpart
> apparatus I discovered that the documentations statement that using
> include is the same as copying and pasting the include into a document
> is false if the include consists of a complete lilypond file. Is there
> a way around that?
>
> This has _nothing_ whatsoever to do with \include, it has to do with
> putting complete documents inside of a \bookpart .  Which does not allow
> for assignments, for example.
>
>> % bookpart test.ly
>>
>> \bookpart {\include "a.ly"}
>> \bookpart {\include "b.ly"}
>
> The problem is that bookparts (and books) don't have their own local
> variable scopes so you cannot do local assignments in them.  The
> expectation would be that they don't generally bleed through to outside,
> and indeed your usage pattern sort of demonstrates the expectation of
> such scoping.
>
> Of course, doing the same in Scheme just works in the global scope and
> thus bypasses this consideration anyway.
>
> --
> David Kastrup

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


Re: include puzzlement

2017-12-29 Thread Carl Sorensen

On 12/29/17, 12:35 PM, "Shane Brandes"  wrote:

wow. o.k. That does mean there is no simple way of maintaining vast
projects via tidy compartmentalization.

%--- file a.ly
\version "2.17.97"

aTitle = "a"




righteOne = \relative g' {
\clef "treble"
g8
}


righteTwo = \relative a' {

d2
}

lefteOne = \relative c' {
\clef "bass"
}

lefteTwo =  \relative a, {
\clef "bass"  r2

}


%--- file b.ly

\version "2.17.97"

  bTitle = "b"



rightTwo = \relative c'' {


r2
}

rightOne = \relative c'' {

  a2.
}

leftOne = \relative c' {

a2.
}

leftTwo = \relative c' {


}

pedal = \relative c {

c4 }

%  --- file scoreastruct.ly
\header{title = \aTitle}
\score {
  \new PianoStaff \with {
instrumentName = "Organ"
  } <<
\new Staff = "right"  << \righteOne \\ \righteTwo >>
\new Staff = "left"  { \clef bass << \lefteOne \\ \lefteTwo >> }
  >>
  \layout { }

}

% --- file scorebstruct.ly
\header{
  title = \bTitle
}

\score {
  <<
\new PianoStaff \with {
  instrumentName = "Organ"
} <<
  \new Staff = "right"  << \rightOne \\ \rightTwo >>
  \new Staff = "left"  { \clef bass << \leftOne \\ \leftTwo >> }
>>
\new Staff = "pedal"{ \clef bass \pedal }
  >>
  \layout { }

}

% --- file scorea.ly
\version "2.17.97"
\include "a.ly"
\include "scoreastruct.ly"

% -- file scoreb.ly
\version "2.17.97"
\include "b.ly"
\include "scorebstruct.ly"

% bookpart test.ly
\version "2.17.97"
\include "a.ly"
\include "b.ly"
\bookpart {
  \include "scoreastruct.ly"
}
\bookpart {
  \include "scorebstruct.ly"
}


Seems to work to me.

Carl


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


Re: include puzzlement

2017-12-29 Thread David Kastrup
Shane Brandes  writes:

> o.k. back to the include with book part problem. Here is my almost
> minimal code example, which consists of files a.ly, b.ly and test.ly.
> The two files compile alone correctly but when stuck in the bookpart
> they go to pieces.

Sigh.  Your original complaint was:

O.k. having gone in circles trying to figure out the whole bookpart
apparatus I discovered that the documentations statement that using
include is the same as copying and pasting the include into a document
is false if the include consists of a complete lilypond file. Is there
a way around that?

This has _nothing_ whatsoever to do with \include, it has to do with
putting complete documents inside of a \bookpart .  Which does not allow
for assignments, for example.

> % bookpart test.ly
>
> \bookpart {\include "a.ly"}
> \bookpart {\include "b.ly"}

The problem is that bookparts (and books) don't have their own local
variable scopes so you cannot do local assignments in them.  The
expectation would be that they don't generally bleed through to outside,
and indeed your usage pattern sort of demonstrates the expectation of
such scoping.

Of course, doing the same in Scheme just works in the global scope and
thus bypasses this consideration anyway.

-- 
David Kastrup

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


Re: include puzzlement

2017-12-29 Thread Caagr98
On 12/29/17 20:26, Carl Sorensen wrote:
> Variables can only be defined at the top level.  See the Notation Reference 
> 3.1.4

That's not entirely true. You can define variables in \paper, \layout, and 
\midi blocks too.

Also, you could use the (ly:parser-define! k v) function inside a bookpart, 
though I don't think that would provide any kind of scoping.

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


Re: include puzzlement

2017-12-29 Thread Kieren MacMillan
p.s. While it's arguably less "simple", there's also Jan-Peter's amazing 
lilytemplate system…  =)

> On Dec 29, 2017, at 2:39 PM, Kieren MacMillan  
> wrote:
> 
> Hi Shane,
> 
>> wow. o.k. That does mean there is no simple way of
>> maintaining vast projects via tidy compartmentalization.
> 
> No… I do it all the time:
>  a_notes.ly
>  a_single_score.ly
>  b_notes.ly
>  b_single_score.ly
>  ab_double_score.ly
>  etc.
> 
> For example, "Robin Hood: The Legendary Musical Comedy" has 40 
> [current/active] cues (i.e., song, transition, underscore, etc.). So I have 
> 40 *_notes.ly files and four score files (Vocal/Choral Score, Piano/Vocal 
> Score, Piano/Conductor Score, and Full Score). For several of them, I also 
> have individual files (e.g., Generosity_vocalselections.ly).
> 
> Hope this helps!
> Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


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


Re: include puzzlement

2017-12-29 Thread Kieren MacMillan
Hi Shane,

> wow. o.k. That does mean there is no simple way of
> maintaining vast projects via tidy compartmentalization.

No… I do it all the time:
  a_notes.ly
  a_single_score.ly
  b_notes.ly
  b_single_score.ly
  ab_double_score.ly
  etc.

For example, "Robin Hood: The Legendary Musical Comedy" has 40 [current/active] 
cues (i.e., song, transition, underscore, etc.). So I have 40 *_notes.ly files 
and four score files (Vocal/Choral Score, Piano/Vocal Score, Piano/Conductor 
Score, and Full Score). For several of them, I also have individual files 
(e.g., Generosity_vocalselections.ly).

Hope this helps!
Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


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


Re: include puzzlement

2017-12-29 Thread Shane Brandes
wow. o.k. That does mean there is no simple way of maintaining vast
projects via tidy compartmentalization.

Thanks for the clarification.

Shane

On Fri, Dec 29, 2017 at 2:26 PM, Carl Sorensen  wrote:
>
>
> On 12/29/17, 12:17 PM, "Timothy Lanfear"  wrote:
>
> A bookpart cannot contain statements like
>
> music = { c'1 }
>
> Yes, this is true.  Variables can only be defined at the top level.  See the 
> Notation Reference 3.1.4
>
> Carl
>
>
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user

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


Re: include puzzlement

2017-12-29 Thread Carl Sorensen


On 12/29/17, 12:17 PM, "Timothy Lanfear"  wrote:

A bookpart cannot contain statements like

music = { c'1 }

Yes, this is true.  Variables can only be defined at the top level.  See the 
Notation Reference 3.1.4

Carl



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


Re: include puzzlement

2017-12-29 Thread Timothy Lanfear

A bookpart cannot contain statements like

music = { c'1 }

After the include processing, your file test.ly begins with something like:

\bookpart {
  music = { c'1 }
  \score { \music }
}

whereas, you should have

music = { c'1 }
\bookpart {
  \score { \music }
}

On 29/12/17 18:35, Shane Brandes wrote:

o.k. back to the include with book part problem. Here is my almost
minimal code example, which consists of files a.ly, b.ly and test.ly.
The two files compile alone correctly but when stuck in the bookpart
they go to pieces. I even tried it running lilypond-book as a tex file
which interestingly yields no page break but otherwise identically
incorrect.

%--- file a.ly
\version "2.17.97"

\header {
   title = "a"

}




righteOne = \relative g' {
 \clef "treble"
 g8
 }


righteTwo = \relative a' {

 d2
 }

lefteOne = \relative c' {
 \clef "bass"
 }

lefteTwo =  \relative a, {
 \clef "bass"  r2

 }


\score {
   \new PianoStaff \with {
 instrumentName = "Organ"
   } <<
 \new Staff = "right"  << \righteOne \\ \righteTwo >>
 \new Staff = "left"  { \clef bass << \lefteOne \\ \lefteTwo >> }
   >>
   \layout { }

}

%--- file b.ly

\version "2.17.97"

\header {

   title = "b"

}


\layout {
   \context {
 \Score
 \remove "Bar_number_engraver"
   }
}



rightTwo = \relative c'' {


r2
}

rightOne = \relative c'' {

   a2.
}

leftOne = \relative c' {

  a2.
}

leftTwo = \relative c' {


}

pedal = \relative c {

  c4 }

\score {
   <<
 \new PianoStaff \with {
   instrumentName = "Organ"
 } <<
   \new Staff = "right"  << \rightOne \\ \rightTwo >>
   \new Staff = "left"  { \clef bass << \leftOne \\ \leftTwo >> }
 >>
 \new Staff = "pedal"{ \clef bass \pedal }
   >>
   \layout { }

}

% bookpart test.ly

\bookpart {\include "a.ly"}
\bookpart {\include "b.ly"}



--
Timothy Lanfear, Bristol, UK.


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


Re: include puzzlement

2017-12-29 Thread Shane Brandes
o.k. back to the include with book part problem. Here is my almost
minimal code example, which consists of files a.ly, b.ly and test.ly.
The two files compile alone correctly but when stuck in the bookpart
they go to pieces. I even tried it running lilypond-book as a tex file
which interestingly yields no page break but otherwise identically
incorrect.

%--- file a.ly
\version "2.17.97"

\header {
  title = "a"

}




righteOne = \relative g' {
\clef "treble"
g8
}


righteTwo = \relative a' {

d2
}

lefteOne = \relative c' {
\clef "bass"
}

lefteTwo =  \relative a, {
\clef "bass"  r2

}


\score {
  \new PianoStaff \with {
instrumentName = "Organ"
  } <<
\new Staff = "right"  << \righteOne \\ \righteTwo >>
\new Staff = "left"  { \clef bass << \lefteOne \\ \lefteTwo >> }
  >>
  \layout { }

}

%--- file b.ly

\version "2.17.97"

\header {

  title = "b"

}


\layout {
  \context {
\Score
\remove "Bar_number_engraver"
  }
}



rightTwo = \relative c'' {


r2
}

rightOne = \relative c'' {

  a2.
}

leftOne = \relative c' {

 a2.
}

leftTwo = \relative c' {


}

pedal = \relative c {

 c4 }

\score {
  <<
\new PianoStaff \with {
  instrumentName = "Organ"
} <<
  \new Staff = "right"  << \rightOne \\ \rightTwo >>
  \new Staff = "left"  { \clef bass << \leftOne \\ \leftTwo >> }
>>
\new Staff = "pedal"{ \clef bass \pedal }
  >>
  \layout { }

}

% bookpart test.ly

\bookpart {\include "a.ly"}
\bookpart {\include "b.ly"}

On Fri, Dec 29, 2017 at 12:37 PM, Shane Brandes  wrote:
> Never mind that code does not function. Still trying to reduce the
> full files into minimal examples that both preserve the problem and
> compile correctly independently and then crash when included.
>
> Shane
>
> On Fri, Dec 29, 2017 at 11:05 AM, Shane Brandes  wrote:
>> O.k. after reducing things here is the problem that causes the snafu.
>> The independent files to be included all happen to have the same
>> structure where the score is defined and the voices called to a
>> variable. as in the following.
>>
>> altoVoice = \relative c' {
>>
>>   a
>> }
>>
>> \score {
>>   \new Staff \with {
>> instrumentName = "Treble"
>>   } { \altoVoice }
>>
>> so the result is as far as I can tell that after the first file which
>> we can call alto1.ly is included the second one, identical in
>> structure, lets call alto2.ly has called for the same input here when
>> the program looks around for the variable altoVoice it decides there
>> is an unrecognized string. Is there anyway around this bar renaming
>> all these variables into unique indentifiers? That would be possible
>> but definitely a time consuming drag.
>>
>> On Fri, Dec 29, 2017 at 3:20 AM, David Kastrup  wrote:
>>> Shane Brandes  writes:
>>>
 O.k. having gone in circles trying to figure out the whole bookpart
 apparatus I discovered that the documentations statement that using
 include is the same as copying and pasting the include into a document
 is false if the include consists of a complete lilypond file.
>>>
>>> Care to show a minimal example?
>>>
 Is there a way around that?
>>>
>>> First one needs to know what your problem is.
>>>
>>> --
>>> David Kastrup

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


Re: include puzzlement

2017-12-29 Thread Shane Brandes
Never mind that code does not function. Still trying to reduce the
full files into minimal examples that both preserve the problem and
compile correctly independently and then crash when included.

Shane

On Fri, Dec 29, 2017 at 11:05 AM, Shane Brandes  wrote:
> O.k. after reducing things here is the problem that causes the snafu.
> The independent files to be included all happen to have the same
> structure where the score is defined and the voices called to a
> variable. as in the following.
>
> altoVoice = \relative c' {
>
>   a
> }
>
> \score {
>   \new Staff \with {
> instrumentName = "Treble"
>   } { \altoVoice }
>
> so the result is as far as I can tell that after the first file which
> we can call alto1.ly is included the second one, identical in
> structure, lets call alto2.ly has called for the same input here when
> the program looks around for the variable altoVoice it decides there
> is an unrecognized string. Is there anyway around this bar renaming
> all these variables into unique indentifiers? That would be possible
> but definitely a time consuming drag.
>
> On Fri, Dec 29, 2017 at 3:20 AM, David Kastrup  wrote:
>> Shane Brandes  writes:
>>
>>> O.k. having gone in circles trying to figure out the whole bookpart
>>> apparatus I discovered that the documentations statement that using
>>> include is the same as copying and pasting the include into a document
>>> is false if the include consists of a complete lilypond file.
>>
>> Care to show a minimal example?
>>
>>> Is there a way around that?
>>
>> First one needs to know what your problem is.
>>
>> --
>> David Kastrup

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


Re: include puzzlement

2017-12-29 Thread Shane Brandes
O.k. after reducing things here is the problem that causes the snafu.
The independent files to be included all happen to have the same
structure where the score is defined and the voices called to a
variable. as in the following.

altoVoice = \relative c' {

  a
}

\score {
  \new Staff \with {
instrumentName = "Treble"
  } { \altoVoice }

so the result is as far as I can tell that after the first file which
we can call alto1.ly is included the second one, identical in
structure, lets call alto2.ly has called for the same input here when
the program looks around for the variable altoVoice it decides there
is an unrecognized string. Is there anyway around this bar renaming
all these variables into unique indentifiers? That would be possible
but definitely a time consuming drag.

On Fri, Dec 29, 2017 at 3:20 AM, David Kastrup  wrote:
> Shane Brandes  writes:
>
>> O.k. having gone in circles trying to figure out the whole bookpart
>> apparatus I discovered that the documentations statement that using
>> include is the same as copying and pasting the include into a document
>> is false if the include consists of a complete lilypond file.
>
> Care to show a minimal example?
>
>> Is there a way around that?
>
> First one needs to know what your problem is.
>
> --
> David Kastrup

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


Re: include puzzlement

2017-12-29 Thread David Kastrup
Shane Brandes  writes:

> O.k. having gone in circles trying to figure out the whole bookpart
> apparatus I discovered that the documentations statement that using
> include is the same as copying and pasting the include into a document
> is false if the include consists of a complete lilypond file.

Care to show a minimal example?

> Is there a way around that?

First one needs to know what your problem is.

-- 
David Kastrup

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


Re: include puzzlement

2017-12-28 Thread Guy Stalnaker
Shane,

Here is one possible way to approach this that I have used:

Use a standard template file that contains the structure for
\header,\score, etc. To create a score, use this sructural template in one
file (say File1) and \include a second file (say File2) that contains
*only* the "music" (e.g., soprano = {}, alto = {}, etc. but no \score or
other structural directives): \include "File2". You have to keep track of
variables used in File2 so they are correct in File1. You compile File1 to
get your midi/pdf output as you work on the score.This lets you create a
set of File1s (File1a, File1b) for the various parts without building a
score from the final book every time. To create the book, you use \book and
\bookpart to create the structure and \include the set of second files,
File2a, File2b, etc. but none of the File1a, File1b files.  Your \book
might look something like this (without all the braces):

\version blah
\language blah
\header blah
\include "File2a" [say, choir parts]
\include "File2b" [say wind quintet]
\book
\bookpart
[optional \header]
\score [uses all included music for a FullScore]
\bookpart
[optional \header]
\score [uses only wind quintet music to create score for them alone]
...

Make sense?

I use \book and \bookpart for nearly everything I do now because it lets me
create a Title page, with lyrics (I mostly write choral music), but I've
done some more complicated things that included instrumental parts,
multiple scores (Full Score, Organ Part, etc.) all with \book and
\bookpart. In case you haven't seen it in the documentation, one very
valuable directive is "  \bookOutputSuffix "Instrument-Parts" that tells LP
to output a PDF file with the indicated suffix added to the filename. You
can use one in each \bookpart. Brilliant.

Hope this helps some.

Regards,

Guy


Guy Stalnaker
jimmyg...@gmail.com

On Thu, Dec 28, 2017 at 11:04 PM, Shane Brandes  wrote:

> O.k. having gone in circles trying to figure out the whole bookpart
> apparatus I discovered that the documentations statement that using
> include is the same as copying and pasting the include into a document
> is false if the include consists of a complete lilypond file. Is there
> a way around that?
>
> Shane
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


include puzzlement

2017-12-28 Thread Shane Brandes
O.k. having gone in circles trying to figure out the whole bookpart
apparatus I discovered that the documentations statement that using
include is the same as copying and pasting the include into a document
is false if the include consists of a complete lilypond file. Is there
a way around that?

Shane

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