Re: Question about '\new Staff =' command

2017-02-02 Thread Urs Liska
Am 02.02.2017 um 21:25 schrieb SoundsFromSound:
> Urs Liska wrote
>> You can use the explicit staff name to access the context (or compare to
>> some arbitrary value), and it's for example used in the \change Staff =
>> "upper" command.
> 
> Can you give an example of a simple score where you create a staff and
> access the context explicitly? I am having trouble visualizing what you
> mean, but I understand the idea and how powerful it can be when it's used in
> practice. 
> 
> (i.e. \new Staff = 'Example')...then later in the file, access \context
> Example and override something.

Not really a practical or understandable one. But you may have a look at
https://github.com/openlilylib/scholarly/blob/master/annotate/engraver.ily#L86

Here an annotation will get a property for the context (i.e. to print
the context where the annotation refers to). If the context is given
explicitly in the annotation (i.e. there's some \with { context = "flute
1" } or so) this is taken. As the next step the function looks for a
named context (i.e. the music happens to be in something like \new Staff
= "flute 1"), and if that fails too it takes the containing directory
name (which is pretty stupid and only makes sense in the project setup
where the scholarLY package was originally developed).

So the idea is that at some point you can extract the name of the Voice
or Staff the current music is in and use that as a label or a lookup key
for something.

HTH
Urs

> 
> Thank you!
> 
> 
> 
> -
> composer | sound designer | asmr artist 
> LilyPond Tutorials (for beginners) --> http://bit.ly/bcl-lilypond
> --
> View this message in context: 
> http://lilypond.1069038.n5.nabble.com/Question-about-new-Staff-command-tp199675p199688.html
> Sent from the Dev mailing list archive at Nabble.com.
> 
> ___
> lilypond-devel mailing list
> lilypond-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-devel
> 


-- 
Urs Liska
https://openlilylib.org
http://lilypondblog.org

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


Re: Question about '\new Staff =' command

2017-02-02 Thread Simon Albrecht

On 02.02.2017 21:25, SoundsFromSound wrote:

Urs Liska wrote

You can use the explicit staff name to access the context (or compare to
some arbitrary value), and it's for example used in the \change Staff =
"upper" command.

Can you give an example of a simple score where you create a staff and
access the context explicitly? I am having trouble visualizing what you
mean, but I understand the idea and how powerful it can be when it's used in
practice.

(i.e. \new Staff = 'Example')...then later in the file, access \context
Example and override something.


Well, the most simple and very common use cases are

%%%
\version "2.19"
\new PianoStaff <<
  \new Staff = upper { s1 }
  \new Staff = lower \relative { g8 a b c  \change Staff = upper 
\voiceTwo d e f g }

>>

<<
  \new Voice = melody { 4 4 2 }
  \new Lyrics \lyricsto melody { text text text }
>>
%%%

One case involving \context would be

%%%
\new ChoirStaff <<
  \new Lyrics = sopLyrics
  \new Staff = sa <<
\new Voice = soprano { \voiceOne 2 4 4 }
\new Voice = alto { \voiceTwo 4 4 2 }
  >>
  \context Lyrics = sopLyrics \lyricsto soprano { text text text }
  \new Lyrics = altoLyrics \lyricsto alto { text text text }
>>
%%%

because \lyricsto can only be used if the associatedVoice context 
already exists.


Best, Simon

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


Re: Question about '\new Staff =' command

2017-02-02 Thread SoundsFromSound
Urs Liska wrote
> You can use the explicit staff name to access the context (or compare to
> some arbitrary value), and it's for example used in the \change Staff =
> "upper" command.

Can you give an example of a simple score where you create a staff and
access the context explicitly? I am having trouble visualizing what you
mean, but I understand the idea and how powerful it can be when it's used in
practice. 

(i.e. \new Staff = 'Example')...then later in the file, access \context
Example and override something.

Thank you!



-
composer | sound designer | asmr artist 
LilyPond Tutorials (for beginners) --> http://bit.ly/bcl-lilypond
--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Question-about-new-Staff-command-tp199675p199688.html
Sent from the Dev mailing list archive at Nabble.com.

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


Re: Question about '\new Staff =' command

2017-02-02 Thread Urs Liska


Am 02.02.2017 um 15:05 schrieb James:
> Hello,
>
> Would someone tell me (as a person who doesn't really use explicit
> 'Staff' commands what the purpose of the \new Staff = 'some string' is?
>
> That is looking at many of the examples in our Docs and Snippets, the
> '=' doesn't appear to do anything other than just be a human readable
> label within the LilyPond file itself and so seems to be no better
> than a kind of comment.
>
> So for example if I simple remove the '= string' part of the \new Staff
> command, it doesn't appear to break anything. Hence the curiosity of
> what this achieve from a technical point of view.
>
> Thank you for your time.

You can use the explicit staff name to access the context (or compare to
some arbitrary value), and it's for example used in the \change Staff =
"upper" command.

HTH
Urs

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

-- 
u...@openlilylib.org
https://openlilylib.org
http://lilypondblog.org


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


Question about '\new Staff =' command

2017-02-02 Thread James
Hello,

Would someone tell me (as a person who doesn't really use explicit
'Staff' commands what the purpose of the \new Staff = 'some string' is?

That is looking at many of the examples in our Docs and Snippets, the
'=' doesn't appear to do anything other than just be a human readable
label within the LilyPond file itself and so seems to be no better
than a kind of comment.

So for example if I simple remove the '= string' part of the \new Staff
command, it doesn't appear to break anything. Hence the curiosity of
what this achieve from a technical point of view.

Thank you for your time.

James

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