Re: Writing score definition in Scheme

2018-03-27 Thread Urs Liska



Am 26.03.2018 um 18:36 schrieb Jan-Peter Voigt:

OK
here's a short hint created with the help of displayMusic:

% a dummy definition of create-staff
#(define (get-staff what)
   (make-music 'ContextSpeccedMusic
 'create-new #t
 'property-operations '()
 'context-type 'Staff
 'element #{ c''4 #}))

% a scheme representation of \new StaffGroup
$(make-music
  'ContextSpeccedMusic
  'create-new #t
  'property-operations '()
  'context-type 'StaffGroup
  'element (make-music
    'SimultaneousMusic
    'elements (map get-staff '(oboe flute


OK, I see how I can go about this.
But actually I have the impression that this will cause much more pain 
that the original state with switching between LilyPond and Scheme. I 
must say I get totally lost in that (considering that there are numerous 
properties to get from function calls.


The point I got to 
(https://git.openlilylib.org/bfsc/kayser/blob/Change-make-staff/includes/lib/make-staff.ily#L240) 
does compile and seems to produce Staff objects but obviously the music 
in it doesn't get through (note that this is another point than the 
original make-score, this is in make-staff instead) ...


Well, maybe I return to that WIP commit after my brain cools down a 
little bit again ...


Best
Urs



HTH Jan-Peter

Am 26.03.2018 um 18:23 schrieb Urs Liska:


Am 26. März 2018 15:35:42 MESZ schrieb Jan-Peter Voigt:

Hi Urs,

I assume you know to build the music-expression for the score in
scheme.

No, not really.
I can replace \score {} with (ly:make-score) but that doesn't really 
help me.
I have no idea how to map the nesting of the parallel contexts to 
Scheme expressions within a single expression.


(get-staff returns Staff objects, but at a later (or earlier) point I 
will also want to create the Staff with Scheme (the music itself will 
stay in LilyPond language files).







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


Re: Writing score definition in Scheme

2018-03-26 Thread Jan-Peter Voigt

OK
here's a short hint created with the help of displayMusic:

% a dummy definition of create-staff
#(define (get-staff what)
   (make-music 'ContextSpeccedMusic
 'create-new #t
 'property-operations '()
 'context-type 'Staff
 'element #{ c''4 #}))

% a scheme representation of \new StaffGroup
$(make-music
  'ContextSpeccedMusic
  'create-new #t
  'property-operations '()
  'context-type 'StaffGroup
  'element (make-music
'SimultaneousMusic
'elements (map get-staff '(oboe flute

HTH Jan-Peter

Am 26.03.2018 um 18:23 schrieb Urs Liska:


Am 26. März 2018 15:35:42 MESZ schrieb Jan-Peter Voigt:

Hi Urs,

I assume you know to build the music-expression for the score in
scheme.

No, not really.
I can replace \score {} with (ly:make-score) but that doesn't really help me.
I have no idea how to map the nesting of the parallel contexts to Scheme 
expressions within a single expression.

(get-staff returns Staff objects, but at a later (or earlier) point I will also 
want to create the Staff with Scheme (the music itself will stay in LilyPond 
language files).




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


Re: Writing score definition in Scheme

2018-03-26 Thread Urs Liska


Am 26. März 2018 15:35:42 MESZ schrieb Jan-Peter Voigt :
>Hi Urs,
>
>I assume you know to build the music-expression for the score in
>scheme. 

No, not really.
I can replace \score {} with (ly:make-score) but that doesn't really help me.
I have no idea how to map the nesting of the parallel contexts to Scheme 
expressions within a single expression.

(get-staff returns Staff objects, but at a later (or earlier) point I will also 
want to create the Staff with Scheme (the music itself will stay in LilyPond 
language files).

>With that you can make use of #(scorify-music mymusic).
>That creates a score object *and* creates the necessary music for << \\
>
> >> constructs an thew like. If you don't need that you can simply use 
>#(ly:make-score mymusic).
>
>HTH
>Jan-Peter
>
>Am 26.03.2018 um 14:51 schrieb Urs Liska:
>> Hi all,
>>
>> I'm embarrassed to admit I don't know where to start looking in the 
>> manuals.
>>
>> I have a scheme-function that returns a \score expression, and I'm 
>> sure I wouldn't have to hop around between LilyPond and Scheme syntax
>
>> like this:
>>
>> make-score =
>> #(define-scheme-function (movement-path)(symbol-list?)
>>    #{
>>  \score {
>>    <<
>>  \new GrandStaff <<
>>    #(get-staff movement-path 'clarino-one)
>>    #(get-staff movement-path 'clarino-two)
>>    #(get-staff movement-path 'corno-one)
>>    #(get-staff movement-path 'corno-two)
>>  >>
>>
>>  #(get-staff movement-path 'tympano)
>>
>>  \new ChoirStaff <<
>>    #(get-staff movement-path 'soprano)
>>    #(get-staff movement-path 'alto)
>>    #(get-staff movement-path 'tenor)
>>    #(get-staff movement-path 'bass)
>>  >>
>>  \new StaffGroup <<
>>    \new GrandStaff <<
>>  #(get-staff movement-path 'violin-one)
>>  #(get-staff movement-path 'violin-two)
>>  #(get-staff movement-path 'viola)
>>    >>
>>    #(get-staff movement-path 'bc)
>>  >>
>>    >>
>>    \midi {}
>>    \layout {}
>>  }
>>    #})
>>
>>
>> The function is also called from within Scheme code, so I would like 
>> to write the same using Scheme only, without switching to LilyPond 
>> with #{ #} but also back to Scheme within these expressions.
>>
>> How would I go about this and/or where would I look up the reference 
>> for this?
>>
>> Thanks
>> Urs
>>
>> ___
>> 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

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


Re: Writing score definition in Scheme

2018-03-26 Thread Jan-Peter Voigt

Hi Urs,

I assume you know to build the music-expression for the score in scheme. 
With that you can make use of #(scorify-music mymusic).
That creates a score object *and* creates the necessary music for << \\ 
>> constructs an thew like. If you don't need that you can simply use 
#(ly:make-score mymusic).


HTH
Jan-Peter

Am 26.03.2018 um 14:51 schrieb Urs Liska:

Hi all,

I'm embarrassed to admit I don't know where to start looking in the 
manuals.


I have a scheme-function that returns a \score expression, and I'm 
sure I wouldn't have to hop around between LilyPond and Scheme syntax 
like this:


make-score =
#(define-scheme-function (movement-path)(symbol-list?)
   #{
 \score {
   <<
 \new GrandStaff <<
   #(get-staff movement-path 'clarino-one)
   #(get-staff movement-path 'clarino-two)
   #(get-staff movement-path 'corno-one)
   #(get-staff movement-path 'corno-two)
 >>

 #(get-staff movement-path 'tympano)

 \new ChoirStaff <<
   #(get-staff movement-path 'soprano)
   #(get-staff movement-path 'alto)
   #(get-staff movement-path 'tenor)
   #(get-staff movement-path 'bass)
 >>
 \new StaffGroup <<
   \new GrandStaff <<
 #(get-staff movement-path 'violin-one)
 #(get-staff movement-path 'violin-two)
 #(get-staff movement-path 'viola)
   >>
   #(get-staff movement-path 'bc)
 >>
   >>
   \midi {}
   \layout {}
 }
   #})


The function is also called from within Scheme code, so I would like 
to write the same using Scheme only, without switching to LilyPond 
with #{ #} but also back to Scheme within these expressions.


How would I go about this and/or where would I look up the reference 
for this?


Thanks
Urs

___
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


Writing score definition in Scheme

2018-03-26 Thread Urs Liska

Hi all,

I'm embarrassed to admit I don't know where to start looking in the 
manuals.


I have a scheme-function that returns a \score expression, and I'm sure 
I wouldn't have to hop around between LilyPond and Scheme syntax like this:


make-score =
#(define-scheme-function (movement-path)(symbol-list?)
   #{
 \score {
   <<
 \new GrandStaff <<
   #(get-staff movement-path 'clarino-one)
   #(get-staff movement-path 'clarino-two)
   #(get-staff movement-path 'corno-one)
   #(get-staff movement-path 'corno-two)
 >>

 #(get-staff movement-path 'tympano)

 \new ChoirStaff <<
   #(get-staff movement-path 'soprano)
   #(get-staff movement-path 'alto)
   #(get-staff movement-path 'tenor)
   #(get-staff movement-path 'bass)
 >>
 \new StaffGroup <<
   \new GrandStaff <<
 #(get-staff movement-path 'violin-one)
 #(get-staff movement-path 'violin-two)
 #(get-staff movement-path 'viola)
   >>
   #(get-staff movement-path 'bc)
 >>
   >>
   \midi {}
   \layout {}
 }
   #})


The function is also called from within Scheme code, so I would like to 
write the same using Scheme only, without switching to LilyPond with #{ 
#} but also back to Scheme within these expressions.


How would I go about this and/or where would I look up the reference for 
this?


Thanks
Urs

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