variable

2017-11-24 Thread Gianmaria Lari
I'm sorry for the trivial question but why this code is wrong?

\version "2.19.80"

music = {a b}
\music


My understanding was that "\music" is substituted by its value "{a b}"
Thank you, g.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: variable

2017-11-24 Thread David Kastrup
Gianmaria Lari  writes:

> I'm sorry for the trivial question but why this code is wrong?
>
> \version "2.19.80"
>
> music = {a b}
> \music
>
>
> My understanding was that "\music" is substituted by its value "{a b}"

You need to put anything in between.  LilyPond looks at \music before
deciding the assignment is complete because the assignment could be

music = {a b} \addlyrics {Oh well}

For that it needs to decide what \music is but the assignment is not yet
complete...

-- 
David Kastrup

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


Re: variable

2017-11-24 Thread Gianmaria Lari
On 24 November 2017 at 09:49, David Kastrup  wrote:

> Gianmaria Lari  writes:
>
> > I'm sorry for the trivial question but why this code is wrong?
> >
> > \version "2.19.80"
> >
> > music = {a b}
> > \music
> >
> >
> > My understanding was that "\music" is substituted by its value "{a
> b}"
>
> You need to put anything in between.  LilyPond looks at \music before
> deciding the assignment is complete because the assignment could be
>
> music = {a b} \addlyrics {Oh well}
>
> For that it needs to decide what \music is but the assignment is not yet
> complete...
>

Thank you David!

It is a bit frustrating. Even apparently simple things are complicated
but that's ok.
Thank you, g.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: variable

2017-11-24 Thread David Kastrup
Gianmaria Lari  writes:

> On 24 November 2017 at 09:49, David Kastrup  wrote:
>
>> Gianmaria Lari  writes:
>>
>> > I'm sorry for the trivial question but why this code is wrong?
>> >
>> > \version "2.19.80"
>> >
>> > music = {a b}
>> > \music
>> >
>> >
>> > My understanding was that "\music" is substituted by its value "{a
>> b}"
>>
>> You need to put anything in between.  LilyPond looks at \music before
>> deciding the assignment is complete because the assignment could be
>>
>> music = {a b} \addlyrics {Oh well}
>>
>> For that it needs to decide what \music is but the assignment is not yet
>> complete...
>
> Thank you David!
>
> It is a bit frustrating.

If you think that is frustrating, try working on the parser.  I didn't
design that insane \addlyrics syntax.

> Even apparently simple things are complicated  but that's ok.

Things are complicated _because_ of appearing simple.  Some simple
appearances are more complicated to do than others.

You would not want to write your music in Scheme syntax, and that would
be by far the simplest to make sense of.

I've worked on that late assignment nuisance a few times already.

-- 
David Kastrup

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


Re: variable

2017-11-24 Thread Werner LEMBERG

>> I'm sorry for the trivial question but why this code is wrong?
>>
>> \version "2.19.80"
>>
>> music = {a b}
>> \music
>>
>>
>> My understanding was that "\music" is substituted by its value "{a
>> b}"
> 
> You need to put anything in between.  LilyPond looks at \music
> before deciding the assignment is complete because the assignment
> could be
> 
>   music = {a b} \addlyrics {Oh well}
> 
> For that it needs to decide what \music is but the assignment is not
> yet complete...

This is documented under `\addlyrics'.  Maybe it makes sense to add a
warning to the variable documentation (or the learning manual)...


Werner

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


Re: variable

2017-11-24 Thread Malte Meyn



Am 24.11.2017 um 09:37 schrieb Gianmaria Lari:

I'm sorry for the trivial question but why this code is wrong?

\version "2.19.80"

music = {a b}
\music


The easiest way to deal with this is to add some scheme code that does 
nothing:


\version "2.19.80"

music = {a b}
#'()
\music

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


Re: variable

2017-11-24 Thread David Kastrup
Malte Meyn  writes:

> Am 24.11.2017 um 09:37 schrieb Gianmaria Lari:
>> I'm sorry for the trivial question but why this code is wrong?
>>
>> \version "2.19.80"
>>
>> music = {a b}
>> \music
>
> The easiest way to deal with this is to add some scheme code that does
> nothing:
>
> \version "2.19.80"
>
> music = {a b}
> #'()
> \music

The easiest way is to write things more recognizably.

music = {a b}

{
  \music
}

will work fine.

-- 
David Kastrup

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


Re: repeat index

2017-11-24 Thread Gianmaria Lari
On 20 November 2017 at 23:01, David Kastrup  wrote:

> Gianmaria Lari  writes:
>
> > On 20 November 2017 at 15:18, David Kastrup  wrote:
> >
> >> Gianmaria Lari  writes:
> >>
> >> > On 20 November 2017 at 12:00, David Kastrup  wrote:
> >> >
> >> >> Gianmaria Lari  writes:
> >>
> >> >> > Is there any (simple) way to rewrite it in a more concise way like
> >> >> > this for example?
> >> >> >
> >> >> >   \repeat unfold 7 {
> >> >> > \modalTranspose c "c+index" \scale \pattern
> >> >> >   }
> >> >>
> >> >> What is simple?
> >> >>
> >> >> \version "2.18.0"
> >> >>
> >> >> scale = {c d e f g a b}
> >> >> pattern = {c d e f}
> >> >>
> >> >> \fixed c' {
> >> >>   #@(map
> >> >>   (lambda (p)
> >> >> #{ \modalTranspose c #(ly:make-pitch -1 p) \scale \pattern
> #})
> >> >>   (iota 8))
> >> >> }
> >> >
> >> > Thank you David, it works perfectly!
> >> >
> >> > Is there any way to encapsulate it in a function to avoid to write
> >> > all the code any time I need it?
> >>
> >> What is "all the code"?  I really have no idea what makes you consider
> >> something simple (and your "explanation" below does not help at all
> >> since it is tantamount to "simple depends on the viewer's metrics").
> >> I also have no idea what part of the above you consider "it" to be
> >> encapsulated and what you consider variable.
> >
> > I'm sorry I have not been clear. If you have a look to the following
> source
> > you'll see that the same code is repeated three times (only the variable
> > 'pattern' changes).
> >
> > \version "2.18.0"
> > scale = {c d e f g a b}
> >
> > pattern = {c d e f}
> > \fixed c' {
> >   #@(map
> >   (lambda (p)
> > #{ \modalTranspose c #(ly:make-pitch -1 p) \scale \pattern #})
> >   (iota 8))
> > }
> >
> > pattern = {f e d c}
> > \fixed c' {
> >   #@(map
> >   (lambda (p)
> > #{ \modalTranspose c #(ly:make-pitch -1 p) \scale \pattern #})
> >   (iota 8))
> > }
> >
> > pattern = {a c e g}
> > \fixed c' {
> >   #@(map
> >   (lambda (p)
> > #{ \modalTranspose c #(ly:make-pitch -1 p) \scale \pattern #})
> >   (iota 8))
> > }
> >
> >
> > I was wondering if it was possible to to avoid this redundancy.
>
> whatever =
> #(define-music-function (pattern) (ly:music?)
>   #{ \fixed c' {
>#@(map
>(lambda (p)
>  #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern #})
>(iota 8))
>  } #})
>
> \whatever {c d e f}
> \whatever {f e d c}
> \whatever {a c e g}
>

I tried the above code but without success. When I tried it few days ago I
was thinking there was some simple to solve problem  and I didn't write you
immediately; I wanted to try to solve the problem by myself but I have not
been able to do it.

This is the complete code according what you wrote (I hope I didn't
introduce any errors):

\version "2.19.80"
scale = {c d e f g a b }

whatever =
#(define-music-function (pattern) (ly:music?)
  #{ \fixed c' {
   #@(map
   (lambda (p)
 #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern #})
   (iota 8))
 } #})

\whatever {c d e f}
\whatever {a c e g}


It looks that #(ly:make-pitch -1 p) inside this function does not decrease
the value of p. So the result is always the same _non transposed_ sequence.
There is also a strange (to me) problem with the octave that's too high ( I
have been able to solve it but I don't understand why it happens).

The same code outside the function works well:

\fixed c' {
  #@(map
  (lambda (p)
#{ \modalTranspose c #(ly:make-pitch -1 p) \scale {c d e f} #})
  (iota 8))
}


What's the issue?
Thank you, g.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: variable

2017-11-24 Thread Gianmaria Lari
On 24 November 2017 at 10:15, Werner LEMBERG  wrote:

>
> >> I'm sorry for the trivial question but why this code is wrong?
> >>
> >> \version "2.19.80"
> >>
> >> music = {a b}
> >> \music
> >>
> >>
> >> My understanding was that "\music" is substituted by its value "{a
> >> b}"
> >
> > You need to put anything in between.  LilyPond looks at \music
> > before deciding the assignment is complete because the assignment
> > could be
> >
> >   music = {a b} \addlyrics {Oh well}
> >
> > For that it needs to decide what \music is but the assignment is not
> > yet complete...
>
> This is documented under `\addlyrics'.  Maybe it makes sense to add a
> warning to the variable documentation (or the learning manual)...


Absolutely agree, it should be written also on the variable documentation.
Probably it will not make big change because people expects things working
as they suppose and easily forget details like this but.
g.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: repeat index

2017-11-24 Thread David Kastrup
Gianmaria Lari  writes:

> On 20 November 2017 at 23:01, David Kastrup  wrote:
>>
>> whatever =
>> #(define-music-function (pattern) (ly:music?)
>>   #{ \fixed c' {
>>#@(map
>>(lambda (p)
>>  #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern #})
>>(iota 8))
>>  } #})
>>
>> \whatever {c d e f}
>> \whatever {f e d c}
>> \whatever {a c e g}
>>
>
> I tried the above code but without success. When I tried it few days ago I
> was thinking there was some simple to solve problem  and I didn't write you
> immediately; I wanted to try to solve the problem by myself but I have not
> been able to do it.
>
> This is the complete code according what you wrote (I hope I didn't
> introduce any errors):
>
> \version "2.19.80"
> scale = {c d e f g a b }
>
> whatever =
> #(define-music-function (pattern) (ly:music?)
>   #{ \fixed c' {
>#@(map
>(lambda (p)
>  #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern #})
>(iota 8))
>  } #})
>
> \whatever {c d e f}
> \whatever {a c e g}
>
>
> It looks that #(ly:make-pitch -1 p) inside this function does not decrease
> the value of p. So the result is always the same _non transposed_ sequence.
> There is also a strange (to me) problem with the octave that's too high ( I
> have been able to solve it but I don't understand why it happens).
>
> The same code outside the function works well:
>
> \fixed c' {
>   #@(map
>   (lambda (p)
> #{ \modalTranspose c #(ly:make-pitch -1 p) \scale {c d e f} #})
>   (iota 8))
> }
>
>
> What's the issue?

Sorry, my fault.  The result is sky-high pitches.  That's typical for
"failure to copy": here #pattern is used over and over again and being
(destructively) transposed every time.

The solution is simply to write $pattern (which _does_ copy, as does
\scale) instead of #pattern in the function.

-- 
David Kastrup

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


Re: repeat index

2017-11-24 Thread bb
Do you think that as a proper question for a lilipond user blog? I think
a scheme blog might be a better place for that problem.

I cannot help, but what however, whatever do you think that code to do?

Regards

Am 24.11.2017 um 10:45 schrieb Gianmaria Lari:
>
>
> whatever =
> #(define-music-function (pattern) (ly:music?)
>   #{ \fixed c' {
>        #@(map
>            (lambda (p)
>              #{ \modalTranspose c #(ly:make-pitch -1 p) \scale
> #pattern #})
>            (iota 8))
>      } #})
>
> \whatever {c d e f}
> \whatever {f e d c}
> \whatever {a c e g}
>
>
> I tried the above code but without success. When I tried it few days
> ago I was thinking there was some simple to solve problem  and I
> didn't write you immediately; I wanted to try to solve the problem by
> myself but I have not been able to do it.
>
> This is the complete code according what you wrote (I hope I didn't
> introduce any errors):
>
> \version "2.19.80"
> scale = {c d e f g a b }
>
> whatever =
> #(define-music-function (pattern) (ly:music?)
>   #{ \fixed c' {
>        #@(map
>            (lambda (p)
>              #{ \modalTranspose c #(ly:make-pitch -1 p) \scale
> #pattern #})
>            (iota 8))
>      } #})
>
> \whatever {c d e f}
> \whatever {a c e g}
>
>  
> It looks that #(ly:make-pitch -1 p) inside this function does not
> decrease the value of p. So the result is always the same _non
> transposed_ sequence. There is also a strange (to me) problem with the
> octave that's too high ( I have been able to solve it but I don't
> understand why it happens).
>
> The same code outside the function works well:
>
> \fixed c' {
>   #@(map
>       (lambda (p)
>         #{ \modalTranspose c #(ly:make-pitch -1 p) \scale {c d e
> f} #})
>       (iota 8))
> }
>
>
> What's the issue?
> Thank you, g.

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


Re: repeat index

2017-11-24 Thread David Kastrup
bb  writes:

> Do you think that as a proper question for a lilipond user blog?

The software is called "LilyPond", and LilyPond-user is not a blog but a
mailing list.  Apart from that, the answer is most emphatically yes.
This is a question about common LilyPond usage.  It is not trivial,
there is no cut&dried answer in the docs, but it's at user-attainable
level.  This is very much what this mailing list is for.

> I think a scheme blog might be a better place for that problem.

Nonsense.  The problems involved here are LilyPond problems, not general
Scheme problems.

> I cannot help, but what however, whatever do you think that code to do?

Uh, have you even been following the discussion?  Once you don't view
this as a blog but a mailing list, you'll realize that there are
_threads_ consisting of mails and answers to those mails.  Your mail
reading software (or at least a mailing list aggregator if you prefer
blog-like treatment) should provide you with the necessary context in
form of the mailing list threads.

-- 
David Kastrup

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


Re: repeat index

2017-11-24 Thread Gianmaria Lari
It works fantastically well. To automatically generate exercise this is
more than great.
Thanks a lot David!
g.

On 24 November 2017 at 10:55, David Kastrup  wrote:

> Gianmaria Lari  writes:
>
> > On 20 November 2017 at 23:01, David Kastrup  wrote:
> >>
> >> whatever =
> >> #(define-music-function (pattern) (ly:music?)
> >>   #{ \fixed c' {
> >>#@(map
> >>(lambda (p)
> >>  #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern
> #})
> >>(iota 8))
> >>  } #})
> >>
> >> \whatever {c d e f}
> >> \whatever {f e d c}
> >> \whatever {a c e g}
> >>
> >
> > I tried the above code but without success. When I tried it few days ago
> I
> > was thinking there was some simple to solve problem  and I didn't write
> you
> > immediately; I wanted to try to solve the problem by myself but I have
> not
> > been able to do it.
> >
> > This is the complete code according what you wrote (I hope I didn't
> > introduce any errors):
> >
> > \version "2.19.80"
> > scale = {c d e f g a b }
> >
> > whatever =
> > #(define-music-function (pattern) (ly:music?)
> >   #{ \fixed c' {
> >#@(map
> >(lambda (p)
> >  #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern
> #})
> >(iota 8))
> >  } #})
> >
> > \whatever {c d e f}
> > \whatever {a c e g}
> >
> >
> > It looks that #(ly:make-pitch -1 p) inside this function does not
> decrease
> > the value of p. So the result is always the same _non transposed_
> sequence.
> > There is also a strange (to me) problem with the octave that's too high
> ( I
> > have been able to solve it but I don't understand why it happens).
> >
> > The same code outside the function works well:
> >
> > \fixed c' {
> >   #@(map
> >   (lambda (p)
> > #{ \modalTranspose c #(ly:make-pitch -1 p) \scale {c d e f} #})
> >   (iota 8))
> > }
> >
> >
> > What's the issue?
>
> Sorry, my fault.  The result is sky-high pitches.  That's typical for
> "failure to copy": here #pattern is used over and over again and being
> (destructively) transposed every time.
>
> The solution is simply to write $pattern (which _does_ copy, as does
> \scale) instead of #pattern in the function.
>
> --
> David Kastrup
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: repeat index

2017-11-24 Thread bb
Sorry, interpreted this repetition as a scheme topic.

Regards

Am 24.11.2017 um 13:43 schrieb David Kastrup:
> bb  writes:
>
>> Do you think that as a proper question for a lilipond user blog?
> The software is called "LilyPond", and LilyPond-user is not a blog but a
> mailing list.  Apart from that, the answer is most emphatically yes.
> This is a question about common LilyPond usage.  It is not trivial,
> there is no cut&dried answer in the docs, but it's at user-attainable
> level.  This is very much what this mailing list is for.
>
>> I think a scheme blog might be a better place for that problem.
> Nonsense.  The problems involved here are LilyPond problems, not general
> Scheme problems.
>
>> I cannot help, but what however, whatever do you think that code to do?
> Uh, have you even been following the discussion?  Once you don't view
> this as a blog but a mailing list, you'll realize that there are
> _threads_ consisting of mails and answers to those mails.  Your mail
> reading software (or at least a mailing list aggregator if you prefer
> blog-like treatment) should provide you with the necessary context in
> form of the mailing list threads.
>


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


Re: Adding \noPageBreak Programatically

2017-11-24 Thread Jay Anderson
I'm coming back to this again. Here's the example below updated and a bit
smaller:

===
\version "2.19.80"

makeStuff =
#(define-void-function () ()
  (add-text #{\markup "fill some space" #})
  (add-score #{ \score { \new Staff { c'1 } } #})
  (add-text #{\markup "Keep with next"#})
  ; This doesn't work:
  (add-score #{ \noPageBreak #})
  (add-score #{ \score { \new Staff { c'1 } } #}))

\makeStuff
===

Compiling the above results in this error:
===
GNU LilyPond 2.19.80
Processing `test.ly'
Parsing...
Interpreting music...
Preprocessing graphical objects...lilypond:
/home/gub/NewGub/gub/target/linux-64/src/lilypond-git.sv.gnu.org--lilypond.git-stable-2.20/lily/book.cc:258:
void Book::process_score(SCM, Paper_book*, Output_def*): Assertion `0'
failed.
Aborted
===

The regular written out way is somehow adding the \noPageBreak directive
differently which I haven't tracked down yet. (Using "(add-score #{ \score
{ \noPageBreak } #})" avoids the above error, but of course creates a blank
staff.)

Essentially I have some functions which generate scores and markup
(music/text is passed in and applied to a score template), but I don't have
a way to control the page breaking between them. (E.g. explanatory text
before an etude shouldn't have a line break). The main alternative I see is
external code generation. This would solve some other issues with this
method of generating scores (mostly bad line numbers in compile errors),
but I'd prefer to not add another tool in the compile chain for the scores
if possible.

Thanks.

-Jay

On Tue, Dec 16, 2014 at 10:31 PM, Jay Anderson  wrote:

> I'm putting in some text before a score and I don't want a page break
> between them. I know how to do this manually. Here's an example:
>
> ===
> \version "2.19.15"
>
> \book
> {
>   \markup "fill some space"
>   \score
>   {
> \new Staff \relative c'
> {
>   \repeat unfold 13 {c1 | \break}
> }
> \layout
> {
>   ragged-right = ##t
> }
>   }
>   \markup "Keep with next"
>
>   \noPageBreak %%% <  What I want to do programatically.
>
>   \score
>   {
> \new Staff \relative c'
> {
>   c1 |
> }
> \layout
> {
>   ragged-right = ##t
> }
>   }
> }
> ===
>
>
> I want to do this programatically. Something like this:
> ===
> \version "2.19.15"
>
> makeStuff =
> #(define-void-function (parser loc) ()
>   (add-text parser #{\markup "fill some space" #})
>   (add-score parser #{
> \score
> {
>   \new Staff \relative c'
>   {
> \repeat unfold 13 {c1 | \break}
>   }
>   \layout
>   {
> ragged-right = ##t
>   }
> }
>   #})
>   (add-text parser #{\markup "Keep with next"#})
>   ; This doesn't work:
>   (add-score parser #{ \noPageBreak #})
>   (add-score parser #{
> \score
> {
>   \new Staff \relative c'
>   {
> c1 |
>   }
>   \layout
>   {
> ragged-right = ##t
>   }
> }
>   #}))
>
> \makeStuff
> ===
>
> Unfortunately I can't get the \noPageBreak to work here. Any ideas on
> the difference? Thanks.
>
> -Jay
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: variable

2017-11-24 Thread David Wright
On Fri 24 Nov 2017 at 10:08:29 (+0100), David Kastrup wrote:
> Gianmaria Lari  writes:
> 
> > On 24 November 2017 at 09:49, David Kastrup  wrote:
> >
> >> Gianmaria Lari  writes:
> >>
> >> > I'm sorry for the trivial question but why this code is wrong?
> >> >
> >> > \version "2.19.80"
> >> >
> >> > music = {a b}
> >> > \music
> >> >
> >> >
> >> > My understanding was that "\music" is substituted by its value "{a
> >> b}"
> >>
> >> You need to put anything in between.  LilyPond looks at \music before
> >> deciding the assignment is complete because the assignment could be
> >>
> >> music = {a b} \addlyrics {Oh well}
> >>
> >> For that it needs to decide what \music is but the assignment is not yet
> >> complete...
> >
> > Thank you David!
> >
> > It is a bit frustrating.
> 
> If you think that is frustrating, try working on the parser.  I didn't
> design that insane \addlyrics syntax.
> 
> > Even apparently simple things are complicated  but that's ok.
> 
> Things are complicated _because_ of appearing simple.  Some simple
> appearances are more complicated to do than others.
> 
> You would not want to write your music in Scheme syntax, and that would
> be by far the simplest to make sense of.
> 
> I've worked on that late assignment nuisance a few times already.

When you think that writing just

\music

can buy you

\score {
  \new Staff {
\new Voice {
  \music
}
  }
}

and more, then having to write at least

{
  \music
}

won't seem so onerous.

Cheers,
David.

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


Re: variable

2017-11-24 Thread Gianmaria Lari
On 24 November 2017 at 16:21, David Wright 
wrote:

> On Fri 24 Nov 2017 at 10:08:29 (+0100), David Kastrup wrote:
> > Gianmaria Lari  writes:
> >
> > > On 24 November 2017 at 09:49, David Kastrup  wrote:
> > >
> > >> Gianmaria Lari  writes:
> > >>
> > >> > I'm sorry for the trivial question but why this code is wrong?
> > >> >
> > >> > \version "2.19.80"
> > >> >
> > >> > music = {a b}
> > >> > \music
> > >> >
> > >> >
> > >> > My understanding was that "\music" is substituted by its value "{a
> > >> b}"
> > >>
> > >> You need to put anything in between.  LilyPond looks at \music before
> > >> deciding the assignment is complete because the assignment could be
> > >>
> > >> music = {a b} \addlyrics {Oh well}
> > >>
> > >> For that it needs to decide what \music is but the assignment is not
> yet
> > >> complete...
> > >
> > > Thank you David!
> > >
> > > It is a bit frustrating.
> >
> > If you think that is frustrating, try working on the parser.  I didn't
> > design that insane \addlyrics syntax.
> >
> > > Even apparently simple things are complicated  but that's ok.
> >
> > Things are complicated _because_ of appearing simple.  Some simple
> > appearances are more complicated to do than others.
> >
> > You would not want to write your music in Scheme syntax, and that would
> > be by far the simplest to make sense of.
> >
> > I've worked on that late assignment nuisance a few times already.
>
> When you think that writing just
>
> \music
>
> can buy you
>
> \score {
>   \new Staff {
> \new Voice {
>   \music
> }
>   }
> }
>
> and more, then having to write at least
>
> {
>   \music
> }
>
> won't seem so onerous.
>
> Cheers,
> David.
>

It was just a theoretical question. I wanted to understand why this code is
correct:

{a}


but not this

music = {a}
\a

Now that I have understand the reason of the behaviour we can discuss it :)
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


scheme function containing score {...}

2017-11-24 Thread Gianmaria Lari
I'm trying to put the score functionality inside a function (consider it a
test). Here it is the code:

\version "2.19.80"
myScore =
#(define (music) (ly:music?) #{
  \score {
$music
\layout{}
\midi{}
   } #} )

\myScore {a b c'}


The code correctly generate a score but it does not generate the midi file.
Why???
I'm using Frescobaldi.
Thank you, g.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: scheme function containing score {...}

2017-11-24 Thread David Kastrup
Gianmaria Lari  writes:

> I'm trying to put the score functionality inside a function (consider it a
> test). Here it is the code:
>
> \version "2.19.80"
> myScore =
> #(define (music) (ly:music?) #{
>   \score {
> $music
> \layout{}
> \midi{}
>} #} )
>
> \myScore {a b c'}
>
>
> The code correctly generate a score but it does not generate the midi file.
> Why???

There is a difference between define (which defines a pure Scheme
function or expression) and define-music-function (which defines
something taking arguments in LilyPond syntax and returning a music
expression) and your input is an interesting mashup where \myScore will
probably be left as *unspecified* after you define an argumentless
Scheme function named `music' that first calls ly:music? without
argument and then would return a score if the ly:music? call had not
already caused an error due to a missing argument.

Now a score is not a music expression anyway, so you should rather
replace define with define-scheme-function here in order to avoid
errors: the resulting \myScore can then return arbitrary expressions
including whole scores.

-- 
David Kastrup

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


Volta Alternatives (music theory)

2017-11-24 Thread Joe Davenport
Hello,

Another basic question to fill the vaults... I like to work with
alternative endings for repeats, i.e.

\repeat volta 2

\alternative { }

where alternative is two endings matched with the repeat number (i'll
explain why):

\alternatives {
{do re do me do }
{ mi re do }
}

I want "volta 2," repeats because it works and the third repetition does
not occur until the ENTIRE score has been read- all the way through. My
thinking is to engrave it as something like this:

C: .. . . . .. .  |__1___| |___2,5___|

My theory isn't what it could be. Do I need a dal signo? My thinking is
that I do, at the end, with a coda at the starting point and a sign on the
ending I wish to repeat! Hopefully this was easy to read. I'm trying to
emulate a simplicity to music and thought I'd share this to hear something
on a technical level.

Thank you.

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


Re: Volta Alternatives (music theory)

2017-11-24 Thread Jacques Menu Muzhic
Hello Joe,

You talk of a third repetition, but show 1, 2, and 5...

Sorry, no idea what you’re after!

JM

> Le 24 nov. 2017 à 21:14, Joe Davenport  a écrit :
> 
> Hello,
> 
> Another basic question to fill the vaults... I like to work with alternative 
> endings for repeats, i.e.
> 
> \repeat volta 2 
> 
> \alternative { }
> 
> where alternative is two endings matched with the repeat number (i'll explain 
> why):
> 
> \alternatives {
> {do re do me do }
> { mi re do }
> }
> 
> I want "volta 2," repeats because it works and the third repetition does not 
> occur until the ENTIRE score has been read- all the way through. My thinking 
> is to engrave it as something like this:
> 
> C: .. . . . .. .  |__1___| |___2,5___|
> 
> My theory isn't what it could be. Do I need a dal signo? My thinking is that 
> I do, at the end, with a coda at the starting point and a sign on the ending 
> I wish to repeat! Hopefully this was easy to read. I'm trying to emulate a 
> simplicity to music and thought I'd share this to hear something on a 
> technical level. 
> 
> Thank you. 
> 
> -- 
> Joseph Davenport
> 
> ___
> 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: Volta Alternatives (music theory)

2017-11-24 Thread David Kastrup
Joe Davenport  writes:

> Hello,
>
> Another basic question to fill the vaults... I like to work with
> alternative endings for repeats, i.e.
>
> \repeat volta 2
>
> \alternative { }
>
> where alternative is two endings matched with the repeat number (i'll
> explain why):
>
> \alternatives {
> {do re do me do }
> { mi re do }
> }
>
> I want "volta 2," repeats because it works and the third repetition does
> not occur until the ENTIRE score has been read- all the way through. My
> thinking is to engrave it as something like this:
>
> C: .. . . . .. .  |__1___| |___2,5___|
>
> My theory isn't what it could be. Do I need a dal signo? My thinking is
> that I do, at the end, with a coda at the starting point and a sign on the
> ending I wish to repeat! Hopefully this was easy to read. I'm trying to
> emulate a simplicity to music and thought I'd share this to hear something
> on a technical level.

I don't see what should happen at the end of the second repetition and
afterwards.  Maybe show the structure of your music as an A B A C
... sequence and we'll try deducing the repeat structure from there?  As
it is, I don't understand how you'll magically skip repetitions 3 and 4
altogether.

-- 
David Kastrup

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


Re: Volta Alternatives (music theory)

2017-11-24 Thread Noeck
Hi Joseph,

I don't understand where your endings 3 and 4 go. But perhaps this could
help you:


{
\repeat volta 5  { a1 }
\alternative {{ b1 } { c'1 } }
}

{
  a1
  \set Score.repeatCommands = #'((volta "1."))
  b1
  \set Score.repeatCommands = #'((volta "2. + 5.") end-repeat)
  c'1
  \set Score.repeatCommands = #'((volta #f))
}

See also:
http://lilypond.org/doc/v2.18/Documentation/notation/long-repeats.html#manual-repeat-marks

Cheers,
Joram

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


RE: Volta Alternatives (music theory)

2017-11-24 Thread Mark Stephen Mrotek
Joe,

 

My sense is that you want.

A

1st ending

A

2nd ending

B

A

3rd ending as the end of the piece.

 

This would be accomplished with a “Da Capo al fine” at the end of the third A. 

The 3rd ending would be noted as “fine.”

 

Mark

 

From: lilypond-user [mailto:lilypond-user-bounces+carsonmark=ca.rr@gnu.org] 
On Behalf Of Joe Davenport
Sent: Friday, November 24, 2017 12:14 PM
To: lilypond-user Mailinglist 
Subject: Volta Alternatives (music theory)

 

Hello,

Another basic question to fill the vaults... I like to work with alternative 
endings for repeats, i.e.

\repeat volta 2 

\alternative { }

where alternative is two endings matched with the repeat number (i'll explain 
why):

\alternatives {

{do re do me do }

{ mi re do }
}

I want "volta 2," repeats because it works and the third repetition does not 
occur until the ENTIRE score has been read- all the way through. My thinking is 
to engrave it as something like this:

C: .. . . . .. .  |__1___| |___2,5___|

 

My theory isn't what it could be. Do I need a dal signo? My thinking is that I 
do, at the end, with a coda at the starting point and a sign on the ending I 
wish to repeat! Hopefully this was easy to read. I'm trying to emulate a 
simplicity to music and thought I'd share this to hear something on a technical 
level. 

 

Thank you. 

 

-- 

Joseph Davenport

 

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