Re: Bug with transpose in functions

2019-07-12 Thread Aaron Hill

On 2019-07-11 11:52 pm, Immanuel Litzroth wrote:

This seems to do the wrong thing:




\version "2.19.81"
testme = #(define-music-function
   (parser location music)
   (ly:music?)
   #{
 \transpose c c' {#music } {#music }
 #})
\testme g'



printing out two g'' instead of a g'' and a g'


Consider using $music or ly:music-deep-copy:


\version "2.19.83"
testI = #(define-music-function (music) (ly:music?)
  #{ \transpose c c' $music $music #})
testII = #(define-music-function (music) (ly:music?)
  #{ \transpose c c' #(ly:music-deep-copy music) #music #})
\testI d' \testII e'




Also I found it strange that {#music} is not accepted as an argument 
with

the
following error:
tmp.ly:6:16: error: GUILE signaled an error for the expression 
beginning

here

   {#
 music}
Unbound variable: music}

It seems to parse the closing } as part of the variable name.


Scheme is pretty permissive with what can be part of a symbol, so this 
is one case where whitespace does matter.



-- Aaron Hill

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


Re: Bug with transpose in functions

2019-07-12 Thread David Kastrup
Immanuel Litzroth  writes:

> This seems to do the wrong thing:
>
>>
> \version "2.19.81"
> testme = #(define-music-function
>(parser location music)
>(ly:music?)
>#{
>  \transpose c c' {#music } {#music }
>  #})
> \testme g'
>>
> printing out two g'' instead of a g'' and a g'

Functions like transpose act destructively on their argument, so you
need a copy or the original will get changed.  Write $music to get a
copy, or use ly:music-deep-copy .

> Also I found it strange that {#music} is not accepted as an argument with
> the
> following error:
>>tmp.ly:6:16: error: GUILE signaled an error for the expression beginning
> here
>>{#
>>  music}
>>Unbound variable: music}
> It seems to parse the closing } as part of the variable name.

Correct.  Scheme syntax is very simple.  Some characters like ()" act as
delimiters, but most others are only split into words with intervening
spaces.  LilyPond syntax is different, but writing # or $ hands control
over to the Scheme parser.

-- 
David Kastrup

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


Re: Bug with transpose in functions

2019-07-12 Thread Werner LEMBERG

> Functions like transpose act destructively on their argument, so you
> need a copy or the original will get changed.  [...]

How can Joe User find out whether a function is acting destructively?


Werner

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


Re: Bug with transpose in functions

2019-07-12 Thread Wols Lists
On 12/07/19 19:04, Werner LEMBERG wrote:
> 
>> Functions like transpose act destructively on their argument, so you
>> need a copy or the original will get changed.  [...]
> 
> How can Joe User find out whether a function is acting destructively?
> 
Computer pedant here :-)

Functions do not have side effects, and for any given input they always
return the same output. So if this is a PROPER function, it cannot act
destructively :-)

Obviously it isn't, so it's technically a subroutine that returns a
value. Dunno how you tell the difference, but that's why you get
computer languages where all variables are "write once" - everything is
based on proper functions.

Maybe the documentation should make a point of saying whether functions
are "proper" or "improper". :-)

Cheers,
Wol


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


Re: Jazz chords layout question

2019-07-12 Thread Robert Schmaus

Hi Jaques,

I guess I can answer some of your questions ..

The box issue: check out the mark formatter settings here:
http://lilypond.org/doc/v2.19/Documentation/notation/bars.en.html#rehearsal-marks

For the percent repeats to appear in a ChordNames context, you'll need 
to have it accept percent repeats first - that's not a default setting.

Placint something like

\context{

  \ChordNames

\consists Percent_repeat_engraver
\consists Double_percent_repeat_engraver
}

in the \layout block should do it. I'm not sure if you'll need both of 
the engravers - just toy around with it ...


About the measure length - sorry no idea. I never bothered about that. 
But I know it *can* be done ... anyone?


About the second volta line. There, I'm not sure if this can be done. If 
so, it looks like it's going to be messy.


Best of luck,
Robert



Am 12.07.19 um 20:33 schrieb Jacques Menu:

Hello folks,

I’m trying to setup the attached example as in the following, with an added 
staff containing empty measures as an exercise score:






What I currently get is:




Questions:
- why do the marks appear without a box around them?
- why does \repeat percent not produce percent signs?
- how can I get the measures to be equal length?
- how can I ‘push’ the beginning of the seconda volta to the middle of 
the line?

Thanks for your help!

JM






___
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: Bug with transpose in functions

2019-07-12 Thread David Kastrup
Werner LEMBERG  writes:

>> Functions like transpose act destructively on their argument, so you
>> need a copy or the original will get changed.  [...]
>
> How can Joe User find out whether a function is acting destructively?

All music functions are allowed to do that by definition because it
would be inefficient if every transformation would have to create a
copy.

-- 
David Kastrup

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


Re: Jazz chords layout question

2019-07-12 Thread Carl Sorensen


On 7/12/19, 12:33 PM, "Jacques Menu"  wrote:

Hello folks,

I’m trying to setup the attached example as in the following, with an added 
staff containing empty measures as an exercise score:





What I currently get is:



Questions:
- why do the marks appear without a box around them?
Because according to the notation reference : 
http://lilypond.org/doc/v2.19/Documentation/notation/bars#rehearsal-marks
markFormatter takes an integer as an input.

%%%
\set Score.markFormatter = #format-mark-box-alphabet
  \override Score.RehearsalMark.font-size = #+5
  \mark 1

- why does \repeat percent not produce percent signs?
Because the ChordNames context doesn't have the Percent_repeat_engraver
%%%
\score {
  <<
\new ChordNames \with {\consists Percent_repeat_engraver} 
\theChords

\new Voice = bass
\with {
  \remove "Note_heads_engraver"
}
\theNotes
  >>
}
%
- how can I get the measures to be equal length?
Use proportionalNotationDuration: 
http://lilypond.org/doc/v2.19/Documentation/notation/proportional-notation


  \set Score.markFormatter = #format-mark-box-alphabet
  \set Score.proportionalNotationDuration = #(ly:make-moment 1/2)
  \override Score.RehearsalMark.font-size = #+5

- how can I ‘push’ the beginning of the seconda volta to the middle of 
the line?
As far as I know, it's not possible without doing lots of tweaks involving 
StartStaff and StopStaff.  But Kieren may be able to help here.

HTH,

Carl


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


Re: Bug with transpose in functions

2019-07-12 Thread David Kastrup
Wols Lists  writes:

> On 12/07/19 19:04, Werner LEMBERG wrote:
>> 
>>> Functions like transpose act destructively on their argument, so you
>>> need a copy or the original will get changed.  [...]
>> 
>> How can Joe User find out whether a function is acting destructively?
>> 
> Computer pedant here :-)
>
> Functions do not have side effects, and for any given input they
> always return the same output. So if this is a PROPER function, it
> cannot act destructively :-)

Nobody said it was.  In computer parlese, functions of the kind you
describe are commonly called pure functions.  Nobody said that music
functions were of that kind.

> Obviously it isn't, so it's technically a subroutine that returns a
> value. Dunno how you tell the difference, but that's why you get
> computer languages where all variables are "write once" - everything
> is based on proper functions.
>
> Maybe the documentation should make a point of saying whether
> functions are "proper" or "improper". :-)

I was pretty sure that I wrote some treatise on that but a superficial
search did not turn it up, and if I do not manage to find some treatise
with a superficial search, it would be too much to expect for a new
user.

-- 
David Kastrup

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


Re: Jazz chords layout question

2019-07-12 Thread Jacques Menu
Hello Robert and Carl,Thanks for your help!To summurize, after checking the docs for marks:	- why do the marks appear without a box around them?		because using ‘\mark "A"’ precludes the box.		Since the AABA scheme is so common in jazz, using:			\mark \markup {\box "A" }		solves the issue.	- why does \repeat percent not produce percent signs?		because the percent repeat engraver is not used by ChordNames by default.		Thus:			\new ChordNames \with {
  \consists Percent_repeat_engraver
}		solves the issue.	- how can I get the measures to be equal length?		by using proportional notation duration:\layout {  \context {    \Score    proportionalNotationDuration = #(ly:make-moment 1/8)  }}		and indents:\paper {  #(set-paper-size "a4")  indent = 0\mm  short-indent = 0.9\cm	- how can I ‘push’ the beginning of the seconda volta to the middle of the line?		that seems difficult, no solution at this timeI attach the resulting score for the record.A nice w-e!JM

TakeTheATrainWorkScoreWithRepeats.ly
Description: Binary data
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Jazz chords layout question

2019-07-12 Thread Jacques Menu
Another, tricky ‘solution', though musically incorrect since:	- it doesn’t use \repeat: the repeat barlines are added manually;	- it adds two hidden skip full measures to push the seconda volta to the right.However:  \set Score.repeatCommands = #'((volta ""))  <> ^\markup {    \scale #'(1.5 . 1.5)    \column{      \line\large { "1." }    }  }produces a hooked line above the staff, but:  \set Score.repeatCommands = #'((volta ""))  <> ^\markup {    \scale #'(1.5 . 1.5)    \column{      \line\large { "2." }    }  }doesn’t.The log is:Starting lilypond 2.19.83 [TakeTheATrainWorkScoreTricky.ly]...Processing `/Users/menu/Documents/LaTeX/PartitionsLilypond/JazzBassWorkScores/TakeTheATrainWorkScoreTricky.ly'Parsing...Interpreting music...[8]warning: already have a volta spanner, ending that one prematurely[16][24]Preprocessing graphical objects...Interpreting music...Preprocessing graphical objects...Calculating line breaks... Drawing systems... Fitting music on 1 page...Drawing systems...programming error: Spanner `VoltaBracket' is not fully contained in parent spanner.  Ignoring orphaned partcontinuing, cross fingersprogramming error: Spanner `VoltaBracket' is not fully contained in parent spanner.  Ignoring orphaned partcontinuing, cross fingersprogramming error: Spanner `VoltaBracket' is not fully contained in parent spanner.  Ignoring orphaned partcontinuing, cross fingersprogramming error: Spanner `VoltaBracket' is not fully contained in parent spanner.  Ignoring orphaned partcontinuing, cross fingersprogramming error: Spanner `VoltaBracket' is not fully contained in parent spanner.  Ignoring orphaned partcontinuing, cross fingersLayout output to `/var/folders/jc/xrpy67_x6_vcjfzpzds_9_6mgn/T//lilypond-7Utxv9'...Converting to `TakeTheATrainWorkScoreTricky.pdf'...Deleting `/var/folders/jc/xrpy67_x6_vcjfzpzds_9_6mgn/T//lilypond-7Utxv9'...Success: compilation successfully completedCompleted successfully in 0.9".JM

TakeTheATrainWorkScoreTricky.ly
Description: Binary data
Le 12 juil. 2019 à 23:39, Jacques Menu  a écrit :Hello Robert and Carl,Thanks for your help!To summurize, after checking the docs for marks:	- why do the marks appear without a box around them?		because using ‘\mark "A"’ precludes the box.		Since the AABA scheme is so common in jazz, using:			\mark \markup {\box "A" }		solves the issue.	- why does \repeat percent not produce percent signs?		because the percent repeat engraver is not used by ChordNames by default.		Thus:			\new ChordNames \with {
  \consists Percent_repeat_engraver
}		solves the issue.	- how can I get the measures to be equal length?		by using proportional notation duration:\layout {  \context {    \Score    proportionalNotationDuration = #(ly:make-moment 1/8)  }}		and indents:\paper {  #(set-paper-size "a4")  indent = 0\mm  short-indent = 0.9\cm	- how can I ‘push’ the beginning of the seconda volta to the middle of the line?		that seems difficult, no solution at this timeI attach the resulting score for the record.A nice w-e!JM___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user