Re: Incipit
Thank you very much for improving the script and sorry that I did not find time to look at the new version before. It is convenient to create an incipit from a selection. Usually it is necessary to change clef and/or time signature for the incipit (e.g. key "mensural-c1" for the cantus in the example I posted earlier). Sometimes it is also necessary to modify the incipit (in the example, the original has a rest before the first notes instead of the upbeat in the transcription, so the rest needs to be added to the incipit). To allow that, the generated Lilypond code for the incipit may be shown to the user for possible modification. Or do you have other ideas? Andreas On 23.01.24 17:02, Richard Shann wrote: On Sun, 2024-01-21 at 12:58 +, Richard Shann wrote: ps I haven't had a chance to investigate your script yet, I'll try to get to it as you said there was some undesirably hard coded value in it. I've done some tinkering with your script for StaffIncipit. There is no obvious way to compute how much space LilyPond will use to typeset the incipit, but I've put in a simple heuristic in this version. And I've taken the notes to be used in the incipit from the selection. A suitable clef etc would need to be (temporarily) inserted to include in the selection. Repeating the command allows you to refine the incipit length and executing it without a selection allows you to delete it. 8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8>< ;;;StaffIncipit (let ((tag "StaffIncipit")(lily "")(incipitLength 15)(indent "20.0") (indentLength 20) (items 0) (lengthInput "15")) (define (accum) (let ((this (d-GetLilyPond))) (set! items (1+ items)) (if this (set! lily (string-append lily this) (if (d-IsInSelection) (begin (SingleAndSelectionSwitcher accum) ;;;avoid mis-matched curly braces in lily (let ((open (string-count lily #\{))(close (string-count lily #\}))) (let loop ((count (- open close))) (if (> count 0) (begin (set! lily (string-append lily "}")) (loop (1- count)) (set! lengthInput (d-DirectiveGet-voice-data tag)) (if (not lengthInput) (set! lengthInput (number->string (+ 5 (* 3 items) ;;;heuristic to guess length (set! lengthInput (d-GetUserInput (_ "Incipit") (_ "Give incipit length for lily staff:") lengthInput)) (if (and (string? indent) (string->number lengthInput)) (set! incipitLength (string->number lengthInput))) (d-DirectivePut-voice-data tag lengthInput) (d-DirectivePut-voice-postfix tag (string-append "\\incipit { " lily " }")) (d-DirectivePut-layout-postfix tag (string-append " incipit-width = " (number->string incipitLength) "\n")) (set! indent (d-DirectiveGet-score-data "ScoreIndent")) (if (and (string? indent) (string->number indent)) (begin (set! indentLength (string->number indent)) (if (> incipitLength indentLength) (d-ScoreIndent (+ incipitLength indentLength)) (begin (if (d-Directive-voice? tag) (begin (d-DirectiveDelete-voice tag) (d-WarningDialog (_ "Staff Incipit Deleted"))) (d-WarningDialog (_ "Cursor not in selection")) 8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8>< If there are no problems with this I could include it in the staff menu. I'm not too sure how to explain what it is for/does - someone just asked on the mailing list whether those special note heads (Petrucci?) etc can be altered ... Richard
Re: Incipit
On Sun, 2024-01-21 at 12:58 +, Richard Shann wrote: > ps I haven't had a chance to investigate your script yet, I'll try to > get to it as you said there was some undesirably hard coded value in > it. I've done some tinkering with your script for StaffIncipit. There is no obvious way to compute how much space LilyPond will use to typeset the incipit, but I've put in a simple heuristic in this version. And I've taken the notes to be used in the incipit from the selection. A suitable clef etc would need to be (temporarily) inserted to include in the selection. Repeating the command allows you to refine the incipit length and executing it without a selection allows you to delete it. 8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8>< ;;;StaffIncipit (let ((tag "StaffIncipit")(lily "")(incipitLength 15)(indent "20.0") (indentLength 20) (items 0) (lengthInput "15")) (define (accum) (let ((this (d-GetLilyPond))) (set! items (1+ items)) (if this (set! lily (string-append lily this) (if (d-IsInSelection) (begin (SingleAndSelectionSwitcher accum) ;;;avoid mis-matched curly braces in lily (let ((open (string-count lily #\{))(close (string-count lily #\}))) (let loop ((count (- open close))) (if (> count 0) (begin (set! lily (string-append lily "}")) (loop (1- count)) (set! lengthInput (d-DirectiveGet-voice-data tag)) (if (not lengthInput) (set! lengthInput (number->string (+ 5 (* 3 items) ;;;heuristic to guess length (set! lengthInput (d-GetUserInput (_ "Incipit") (_ "Give incipit length for lily staff:") lengthInput)) (if (and (string? indent) (string->number lengthInput)) (set! incipitLength (string->number lengthInput))) (d-DirectivePut-voice-data tag lengthInput) (d-DirectivePut-voice-postfix tag (string-append "\\incipit { " lily " }")) (d-DirectivePut-layout-postfix tag (string-append " incipit-width = " (number->string incipitLength) "\n")) (set! indent (d-DirectiveGet-score-data "ScoreIndent")) (if (and (string? indent) (string->number indent)) (begin (set! indentLength (string->number indent)) (if (> incipitLength indentLength) (d-ScoreIndent (+ incipitLength indentLength)) (begin (if (d-Directive-voice? tag) (begin (d-DirectiveDelete-voice tag) (d-WarningDialog (_ "Staff Incipit Deleted"))) (d-WarningDialog (_ "Cursor not in selection")) 8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8>< If there are no problems with this I could include it in the staff menu. I'm not too sure how to explain what it is for/does - someone just asked on the mailing list whether those special note heads (Petrucci?) etc can be altered ... Richard
Re: Incipit
On Sun, 2024-01-21 at 19:04 +0100, Andreas Schneider wrote: > Thanks a lot, now it works as intended. Plus I have finally > understood > what the postfix and prefix tags do. The prefix and postfix fields do different things for the various directives, and where they put themselves can be further altered by the setting of the override field, but generally the prefix field gets inserted earlier in the syntax than the postfix field. Richard > > Andreas > > > On 21.01.24 18:57, Richard Shann wrote: > > On Sun, 2024-01-21 at 14:13 +0100, Andreas Schneider wrote: > > > Yes, that is what I tried to describe. The correct syntax would > > > be > > > > > > \new Voice = "MvmntIVoiceI" { \incipit { \clef "mensural-c1" \key > > > g > > > \dorian r2 g'8 a' bes' c'' } > > > \clef treble \key d \minor \time 2/2 \MvmntIVoiceI } > > > > > > instead of > > > > > > \new Voice = "MvmntIVoiceI" \incipit { \clef "mensural-c1" \key g > > > \dorian r2 g'8 a' bes' c'' } { > > > \clef treble \key d \minor \time 2/2 \MvmntIVoiceI } > > > > In the samples directory is a score > > AllDenemoDirectiveOutputs.denemo > > and loading this and looking in the LilyPond view you can see the > > directive needed to put text there: > > > > [..] > > %Start of Staff > > \new Staff = "Part 1" %{staff prefix%} > > << %{staff postfix%} > > > > \new Voice = "MvmntIVoiceI" %{voice prefix%} > > { %{voice postfix%} > > > > %{clef prefix%} > > \clef treble %{clef postfix%} > > \key c \major \time 4/4 \MvmntIVoiceI > > } %End of voice > > > > >> %End of Staff > > [...] > > The one you want is marked %{voice postfix%} > > the one you have is marked %{voice prefix%} > > so all you need to do is replace prefix with postfix in the > > procedure > > call > > > > (d-DirectivePut-voice-prefix tag (string-append "\\incipit > > { " > > current " }")) > > > > and all should be well. > > > > Richard > > > > > > > > that is the incipit is after the opening brace of the voice > > > instead > > > before. > > > > > > Andreas > > > > > > > > > On 21.01.24 13:58, Richard Shann wrote: > > > > On Sun, 2024-01-21 at 13:31 +0100, Andreas Schneider wrote: > > > > > With my incipit script I have the problem that lyrics are not > > > > > displayed. > > > > > Looking into the lilypond code, I notice that the problem is > > > > > that > > > > > the > > > > > incipit is inserted before the opening brace in the voice and > > > > > not > > > > > after. > > > > > This can be seen in attached score, in which the incipit is > > > > > inserted > > > > > directly after \new Voice = "MvmntIVoiceI" while the correct > > > > > position > > > > > would be after the opening brace > > > > > > > > where is that (in terms of the LilyPond syntax). That is, have > > > > you > > > > worked out the LilyPond syntax you need to get what you want. > > > > You > > > > have > > > > to do this before you can hope to write a script that generates > > > > it > > > > (of > > > > course). > > > > I used the Customize Score Layout option in the LilyPond View > > > > (continuous typesetting off, click on the "Score Layout > > > > Options" > > > > button) and the moved the incipit to after > > > > > > > > \new ChoirStaff << > > > > > > > > and this created an extra staff. You can ask on > > > > lilypond-u...@gnu.org > > > > if the docs don't help. > > > > > > > > HTH > > > > > > > > Richard > > > > ps I haven't had a chance to investigate your script yet, I'll > > > > try > > > > to > > > > get to it as you said there was some undesirably hard coded > > > > value > > > > in > > > > it. > > > > > > > > > > > > > that now follows the incipit. What do I > > > > > need to change in the script to insert the incipit at the > > > > > correct > > > > > place? > > > > > You find the script below. > > > > > > > > > > Thanks in advance > > > > > > > > > > Andreas > > > > > > > > > > > > > > > ;;;StaffIncipit > > > > > (let ((tag "StaffIncipit") (current "") (lengthInput "15") > > > > > (incipitLength 15) (indent "20.0") (indentLength 20) ) > > > > > (set! current (d-DirectiveGet-voice-data tag)) > > > > > (if (not (string? current)) (set! current "")) > > > > > (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit > > > > > for > > > > > current > > > > > staff:") current)) > > > > > (if (string? current) > > > > > (begin > > > > > (set! lengthInput (d-GetUserInput (_ "Incipit") (_ > > > > > "Give > > > > > incipit > > > > > length for current staff:") lengthInput)) > > > > > (if (and (string? indent) (string->number > > > > > lengthInput)) > > > > > (set! incipitLength (string->number lengthInput))) > > > > > (d-DirectivePut-voice-data tag current) > > > > > (d-DirectivePut-voice-prefix tag (string-append > > > > > "\\incipit > > > > > { " > > > > > current " }")) > > > > > (d-DirectivePut-layout-postfix tag
Re: Incipit
Thanks a lot, now it works as intended. Plus I have finally understood what the postfix and prefix tags do. Andreas On 21.01.24 18:57, Richard Shann wrote: On Sun, 2024-01-21 at 14:13 +0100, Andreas Schneider wrote: Yes, that is what I tried to describe. The correct syntax would be \new Voice = "MvmntIVoiceI" { \incipit { \clef "mensural-c1" \key g \dorian r2 g'8 a' bes' c'' } \clef treble \key d \minor \time 2/2 \MvmntIVoiceI } instead of \new Voice = "MvmntIVoiceI" \incipit { \clef "mensural-c1" \key g \dorian r2 g'8 a' bes' c'' } { \clef treble \key d \minor \time 2/2 \MvmntIVoiceI } In the samples directory is a score AllDenemoDirectiveOutputs.denemo and loading this and looking in the LilyPond view you can see the directive needed to put text there: [..] %Start of Staff \new Staff = "Part 1" %{staff prefix%} << %{staff postfix%} \new Voice = "MvmntIVoiceI" %{voice prefix%} { %{voice postfix%} %{clef prefix%} \clef treble %{clef postfix%} \key c \major\time 4/4 \MvmntIVoiceI } %End of voice >> %End of Staff [...] The one you want is marked %{voice postfix%} the one you have is marked %{voice prefix%} so all you need to do is replace prefix with postfix in the procedure call (d-DirectivePut-voice-prefix tag (string-append "\\incipit { " current " }")) and all should be well. Richard that is the incipit is after the opening brace of the voice instead before. Andreas On 21.01.24 13:58, Richard Shann wrote: On Sun, 2024-01-21 at 13:31 +0100, Andreas Schneider wrote: With my incipit script I have the problem that lyrics are not displayed. Looking into the lilypond code, I notice that the problem is that the incipit is inserted before the opening brace in the voice and not after. This can be seen in attached score, in which the incipit is inserted directly after \new Voice = "MvmntIVoiceI" while the correct position would be after the opening brace where is that (in terms of the LilyPond syntax). That is, have you worked out the LilyPond syntax you need to get what you want. You have to do this before you can hope to write a script that generates it (of course). I used the Customize Score Layout option in the LilyPond View (continuous typesetting off, click on the "Score Layout Options" button) and the moved the incipit to after \new ChoirStaff << and this created an extra staff. You can ask on lilypond-u...@gnu.org if the docs don't help. HTH Richard ps I haven't had a chance to investigate your script yet, I'll try to get to it as you said there was some undesirably hard coded value in it. that now follows the incipit. What do I need to change in the script to insert the incipit at the correct place? You find the script below. Thanks in advance Andreas ;;;StaffIncipit (let ((tag "StaffIncipit") (current "") (lengthInput "15") (incipitLength 15) (indent "20.0") (indentLength 20) ) (set! current (d-DirectiveGet-voice-data tag)) (if (not (string? current)) (set! current "")) (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit for current staff:") current)) (if (string? current) (begin (set! lengthInput (d-GetUserInput (_ "Incipit") (_ "Give incipit length for current staff:") lengthInput)) (if (and (string? indent) (string->number lengthInput)) (set! incipitLength (string->number lengthInput))) (d-DirectivePut-voice-data tag current) (d-DirectivePut-voice-prefix tag (string-append "\\incipit { " current " }")) (d-DirectivePut-layout-postfix tag (string-append " incipit- width = " (number->string incipitLength) "\n")) (set! indent (d-DirectiveGet-score-data "ScoreIndent")) (if (and (string? indent) (string->number indent)) (begin (set! indentLength (string->number indent)) (if (> incipitLength indentLength) (d-ScoreIndent (+ incipitLength indentLength
Re: Incipit
On Sun, 2024-01-21 at 14:13 +0100, Andreas Schneider wrote: > Yes, that is what I tried to describe. The correct syntax would be > > \new Voice = "MvmntIVoiceI" { \incipit { \clef "mensural-c1" \key g > \dorian r2 g'8 a' bes' c'' } > \clef treble \key d \minor \time 2/2 \MvmntIVoiceI } > > instead of > > \new Voice = "MvmntIVoiceI" \incipit { \clef "mensural-c1" \key g > \dorian r2 g'8 a' bes' c'' } { > \clef treble \key d \minor \time 2/2 \MvmntIVoiceI } In the samples directory is a score AllDenemoDirectiveOutputs.denemo and loading this and looking in the LilyPond view you can see the directive needed to put text there: [..] %Start of Staff \new Staff = "Part 1" %{staff prefix%} << %{staff postfix%} \new Voice = "MvmntIVoiceI" %{voice prefix%} { %{voice postfix%} %{clef prefix%} \clef treble %{clef postfix%} \key c \major\time 4/4 \MvmntIVoiceI } %End of voice >> %End of Staff [...] The one you want is marked %{voice postfix%} the one you have is marked %{voice prefix%} so all you need to do is replace prefix with postfix in the procedure call (d-DirectivePut-voice-prefix tag (string-append "\\incipit { " current " }")) and all should be well. Richard > > that is the incipit is after the opening brace of the voice instead > before. > > Andreas > > > On 21.01.24 13:58, Richard Shann wrote: > > On Sun, 2024-01-21 at 13:31 +0100, Andreas Schneider wrote: > > > With my incipit script I have the problem that lyrics are not > > > displayed. > > > Looking into the lilypond code, I notice that the problem is that > > > the > > > incipit is inserted before the opening brace in the voice and not > > > after. > > > This can be seen in attached score, in which the incipit is > > > inserted > > > directly after \new Voice = "MvmntIVoiceI" while the correct > > > position > > > would be after the opening brace > > > > where is that (in terms of the LilyPond syntax). That is, have you > > worked out the LilyPond syntax you need to get what you want. You > > have > > to do this before you can hope to write a script that generates it > > (of > > course). > > I used the Customize Score Layout option in the LilyPond View > > (continuous typesetting off, click on the "Score Layout Options" > > button) and the moved the incipit to after > > > > \new ChoirStaff << > > > > and this created an extra staff. You can ask on > > lilypond-u...@gnu.org > > if the docs don't help. > > > > HTH > > > > Richard > > ps I haven't had a chance to investigate your script yet, I'll try > > to > > get to it as you said there was some undesirably hard coded value > > in > > it. > > > > > > > that now follows the incipit. What do I > > > need to change in the script to insert the incipit at the correct > > > place? > > > You find the script below. > > > > > > Thanks in advance > > > > > > Andreas > > > > > > > > > ;;;StaffIncipit > > > (let ((tag "StaffIncipit") (current "") (lengthInput "15") > > > (incipitLength 15) (indent "20.0") (indentLength 20) ) > > > (set! current (d-DirectiveGet-voice-data tag)) > > > (if (not (string? current)) (set! current "")) > > > (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit for > > > current > > > staff:") current)) > > > (if (string? current) > > > (begin > > > (set! lengthInput (d-GetUserInput (_ "Incipit") (_ "Give > > > incipit > > > length for current staff:") lengthInput)) > > > (if (and (string? indent) (string->number lengthInput)) > > > (set! incipitLength (string->number lengthInput))) > > > (d-DirectivePut-voice-data tag current) > > > (d-DirectivePut-voice-prefix tag (string-append "\\incipit > > > { " > > > current " }")) > > > (d-DirectivePut-layout-postfix tag (string-append " > > > incipit- > > > width > > > = " (number->string incipitLength) "\n")) > > > (set! indent (d-DirectiveGet-score-data "ScoreIndent")) > > > (if (and (string? indent) (string->number indent)) > > > (begin > > > (set! indentLength (string->number indent)) > > > (if (> incipitLength indentLength) > > > (d-ScoreIndent (+ incipitLength indentLength > > > >
Re: Incipit
Yes, that is what I tried to describe. The correct syntax would be \new Voice = "MvmntIVoiceI" { \incipit { \clef "mensural-c1" \key g \dorian r2 g'8 a' bes' c'' } \clef treble\key d \minor\time 2/2 \MvmntIVoiceI } instead of \new Voice = "MvmntIVoiceI" \incipit { \clef "mensural-c1" \key g \dorian r2 g'8 a' bes' c'' } { \clef treble\key d \minor\time 2/2 \MvmntIVoiceI } that is the incipit is after the opening brace of the voice instead before. Andreas On 21.01.24 13:58, Richard Shann wrote: On Sun, 2024-01-21 at 13:31 +0100, Andreas Schneider wrote: With my incipit script I have the problem that lyrics are not displayed. Looking into the lilypond code, I notice that the problem is that the incipit is inserted before the opening brace in the voice and not after. This can be seen in attached score, in which the incipit is inserted directly after \new Voice = "MvmntIVoiceI" while the correct position would be after the opening brace where is that (in terms of the LilyPond syntax). That is, have you worked out the LilyPond syntax you need to get what you want. You have to do this before you can hope to write a script that generates it (of course). I used the Customize Score Layout option in the LilyPond View (continuous typesetting off, click on the "Score Layout Options" button) and the moved the incipit to after \new ChoirStaff << and this created an extra staff. You can ask on lilypond-u...@gnu.org if the docs don't help. HTH Richard ps I haven't had a chance to investigate your script yet, I'll try to get to it as you said there was some undesirably hard coded value in it. that now follows the incipit. What do I need to change in the script to insert the incipit at the correct place? You find the script below. Thanks in advance Andreas ;;;StaffIncipit (let ((tag "StaffIncipit") (current "") (lengthInput "15") (incipitLength 15) (indent "20.0") (indentLength 20) ) (set! current (d-DirectiveGet-voice-data tag)) (if (not (string? current)) (set! current "")) (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit for current staff:") current)) (if (string? current) (begin (set! lengthInput (d-GetUserInput (_ "Incipit") (_ "Give incipit length for current staff:") lengthInput)) (if (and (string? indent) (string->number lengthInput)) (set! incipitLength (string->number lengthInput))) (d-DirectivePut-voice-data tag current) (d-DirectivePut-voice-prefix tag (string-append "\\incipit { " current " }")) (d-DirectivePut-layout-postfix tag (string-append " incipit- width = " (number->string incipitLength) "\n")) (set! indent (d-DirectiveGet-score-data "ScoreIndent")) (if (and (string? indent) (string->number indent)) (begin (set! indentLength (string->number indent)) (if (> incipitLength indentLength) (d-ScoreIndent (+ incipitLength indentLength
Re: Incipit
On Sun, 2024-01-21 at 13:31 +0100, Andreas Schneider wrote: > With my incipit script I have the problem that lyrics are not > displayed. > Looking into the lilypond code, I notice that the problem is that the > incipit is inserted before the opening brace in the voice and not > after. > This can be seen in attached score, in which the incipit is inserted > directly after \new Voice = "MvmntIVoiceI" while the correct position > would be after the opening brace where is that (in terms of the LilyPond syntax). That is, have you worked out the LilyPond syntax you need to get what you want. You have to do this before you can hope to write a script that generates it (of course). I used the Customize Score Layout option in the LilyPond View (continuous typesetting off, click on the "Score Layout Options" button) and the moved the incipit to after \new ChoirStaff << and this created an extra staff. You can ask on lilypond-u...@gnu.org if the docs don't help. HTH Richard ps I haven't had a chance to investigate your script yet, I'll try to get to it as you said there was some undesirably hard coded value in it. > that now follows the incipit. What do I > need to change in the script to insert the incipit at the correct > place? > You find the script below. > > Thanks in advance > > Andreas > > > ;;;StaffIncipit > (let ((tag "StaffIncipit") (current "") (lengthInput "15") > (incipitLength 15) (indent "20.0") (indentLength 20) ) > (set! current (d-DirectiveGet-voice-data tag)) > (if (not (string? current)) (set! current "")) > (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit for > current > staff:") current)) > (if (string? current) > (begin > (set! lengthInput (d-GetUserInput (_ "Incipit") (_ "Give incipit > length for current staff:") lengthInput)) > (if (and (string? indent) (string->number lengthInput)) > (set! incipitLength (string->number lengthInput))) > (d-DirectivePut-voice-data tag current) > (d-DirectivePut-voice-prefix tag (string-append "\\incipit { " > current " }")) > (d-DirectivePut-layout-postfix tag (string-append " incipit- > width > = " (number->string incipitLength) "\n")) > (set! indent (d-DirectiveGet-score-data "ScoreIndent")) > (if (and (string? indent) (string->number indent)) > (begin > (set! indentLength (string->number indent)) > (if (> incipitLength indentLength) > (d-ScoreIndent (+ incipitLength indentLength
Re: Incipit
With my incipit script I have the problem that lyrics are not displayed. Looking into the lilypond code, I notice that the problem is that the incipit is inserted before the opening brace in the voice and not after. This can be seen in attached score, in which the incipit is inserted directly after \new Voice = "MvmntIVoiceI" while the correct position would be after the opening brace that now follows the incipit. What do I need to change in the script to insert the incipit at the correct place? You find the script below. Thanks in advance Andreas ;;;StaffIncipit (let ((tag "StaffIncipit") (current "") (lengthInput "15") (incipitLength 15) (indent "20.0") (indentLength 20) ) (set! current (d-DirectiveGet-voice-data tag)) (if (not (string? current)) (set! current "")) (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit for current staff:") current)) (if (string? current) (begin (set! lengthInput (d-GetUserInput (_ "Incipit") (_ "Give incipit length for current staff:") lengthInput)) (if (and (string? indent) (string->number lengthInput)) (set! incipitLength (string->number lengthInput))) (d-DirectivePut-voice-data tag current) (d-DirectivePut-voice-prefix tag (string-append "\\incipit { " current " }")) (d-DirectivePut-layout-postfix tag (string-append " incipit-width = " (number->string incipitLength) "\n")) (set! indent (d-DirectiveGet-score-data "ScoreIndent")) (if (and (string? indent) (string->number indent)) (begin (set! indentLength (string->number indent)) (if (> incipitLength indentLength) (d-ScoreIndent (+ incipitLength indentLength http://denemo.org/xmlns/Denemo; version="8"> ScoreTitles title = \markup \with-url #'"scheme:(DenemoSetTitles \"ScoreTitles\" 'title #t)" {Fuggi fuggi fuggi da questo cielo} composer = \markup \with-url #'"scheme:(DenemoSetTitles \"ScoreTitles\" 'composer #t)" {Giuseppe Cenci († 1616)} Score Titles (list (cons 'dedication #f)(cons 'title "Fuggi fuggi fuggi da questo cielo")(cons 'subtitle #f)(cons 'subsubtitle #f)(cons 'instrument #f)(cons 'poet #f)(cons 'composer "Giuseppe Cenci († 1616)")(cons 'meter #f)(cons 'arranger #f)(cons 'tagline #f)(cons 'copyright #f)(cons 'piece #f)(cons 'opus #f) '()) 4 VersionTagline tagline = \markup {Version vom \simple #(strftime "%d. %b %Y" (localtime (current-time)))} 1 3 1 3 0 2147483647 a4 2.24 18 1 3074 ScoreComment Sources http://www.internetculturale.it/jmms/iccuviewer/iccu.jsp?id=oai%3Awww.internetculturale.sbn.it%2FTeca%3A20%3ANT%3AIFC361 12 ScoreIndent \layout {indent = 35} indent=35 35 4 1 1 7 2 -1 100 100 100 100 StaffIncipit incipit-width = 25 120 Cantus 1 2 2 5 1 0 NONE 127 0 0 0 0 0 0 Fug -- gi fug -- gi fug -- gi da que -- sto cie -- lo a -- spro~e du -- ro spie -- ta -- to ge -- lo Tu che tut -- to~im -- pri -- gio -- ni~e le -- ghi né per pian -- to ti fran -- gi~o pie -- ghi fier ti -- ran -- no, giel del l'an -- no fug -- gi fug -- gi fug -- gi là do -- ve~il ver -- no su le bri -- ne ha seg -- gio~e -- ter -- no. InstrumentName instrumentName = \markup { \with-url #'"scheme:(d-GoToPosition 1 1 1 1)(let ((choice (d-PopupMenu (list (cons (_ \"Change Name\") d-InstrumentName) (cons (_ \"Change Indent\") d-ScoreIndent) (if choice (choice)))" "" } 22 ChoirStaffStart \new ChoirStaff Choir Staff Start 52 StaffIncipit \incipit { \clef "mensural-c1" \key g \dorian r2 g'8 a' bes' c'' } \clef "mensural-c1" \key g \dorian r2 g'8 a' bes' c'' Upbeat \partial 256*128 Upbeat emmentaler 62 30 20 15 268435456 BeamingOff \autoBeamOff No Beaming BeamingOff 30 -44 Repeat \repeat
Re: Incipit
Thanks again for your help. Using ScoreIndent I arrive at a script that does what I expect: ;;;StaffIncipit (let ((tag "StaffIncipit") (current "") (incipitLength 10) (indent "15.0") (indentLength 15) ) (set! current (d-DirectiveGet-voice-data tag)) (if (not (string? current)) (set! current "")) (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit for current staff:") current)) (if (string? current) (begin (d-DirectivePut-voice-data tag current) (d-DirectivePut-voice-prefix tag (string-append "\\incipit { " current " }")) (d-DirectivePut-layout-postfix tag (string-append " incipit-width = " (number->string incipitLength) "\n")) (set! indent (d-DirectiveGet-score-data "ScoreIndent")) (if (and (string? indent) (string->number indent)) (begin (set! indentLength (string->number indent)) (if (> incipitLength indentLength) (d-ScoreIndent (+ incipitLength indentLength The only deficiency I still see is that the incipit length is fixed and hard-coded in the script, but I have no idea how to calculate it and I can live with that. If you want, you can take over the script. Andreas Am 17.12.23 um 11:49 schrieb Richard Shann: On Sat, 2023-12-16 at 21:25 +0100, Andreas Schneider wrote: Thank you very much for your help. One more question: how can I get the current indent There are two indent commands Command: Indent Alter the indent of the opening system for the current movement. Location: Object Menu ▶ Movements ▶ Typesetter ▶ Print Layout Internal Name: Indent and Command: Indent Indent the first system of every movement by the given amount. Location: Object Menu ▶ Score ▶ Typesetter ▶ Print Layout Internal Name: ScoreIndent The Instrument name command Command: Instrument Name Print Instrument name before staff at start of score, Location: Object Menu ▶ Staffs/Voices ▶ Staff Properties Internal Name: InstrumentName runs the second (*) of those Indent commands, so to retrieve the value set you need (d-DirectiveGet-score-data "ScoreIndent") to get that value. The value set by InstrumentName is just a very crude guess based on the length of the name, a proper job would require querying LilyPond about how much space is required ... Richard (*) I don't know why this is so, it was a long time ago and perhaps it would be better to do otherwise...
Re: Incipit
On Sat, 2023-12-16 at 21:25 +0100, Andreas Schneider wrote: > Thank you very much for your help. One more question: how can I get > the > current indent There are two indent commands Command: Indent Alter the indent of the opening system for the current movement. Location: Object Menu ▶ Movements ▶ Typesetter ▶ Print Layout Internal Name: Indent and Command: Indent Indent the first system of every movement by the given amount. Location: Object Menu ▶ Score ▶ Typesetter ▶ Print Layout Internal Name: ScoreIndent The Instrument name command Command: Instrument Name Print Instrument name before staff at start of score, Location: Object Menu ▶ Staffs/Voices ▶ Staff Properties Internal Name: InstrumentName runs the second (*) of those Indent commands, so to retrieve the value set you need (d-DirectiveGet-score-data "ScoreIndent") to get that value. The value set by InstrumentName is just a very crude guess based on the length of the name, a proper job would require querying LilyPond about how much space is required ... Richard (*) I don't know why this is so, it was a long time ago and perhaps it would be better to do otherwise... > so that I can compare to the incipit length and increase > it if necessary? I'm trying the following after looking at > Indent.scm, > but I always get #f > > ;;;StaffIncipit > (let ((tag "StaffIncipit") (current "") (incipitLength 10) (indent > "15.0") ) > (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit for > current staff:") current)) > (if (string? current) > (begin > (d-DirectivePut-voice-prefix tag (string-append "\\incipit { " > current " }")) > (d-DirectivePut-layout-postfix tag (string-append " incipit-width > = > " (number->string incipitLength) "\n")) > (set! indent (d-DirectiveGet-layout-data "Indent")) > (disp (number? indent) (string? indent) indent) > (if (and (string? indent) (string->number indent)) > (if (> incipitLength (string->number indent)) > (d-Indent incipitLength)) > > Andreas >
Re: Incipit
Thank you very much for your help. One more question: how can I get the current indent so that I can compare to the incipit length and increase it if necessary? I'm trying the following after looking at Indent.scm, but I always get #f ;;;StaffIncipit (let ((tag "StaffIncipit") (current "") (incipitLength 10) (indent "15.0") ) (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit for current staff:") current)) (if (string? current) (begin (d-DirectivePut-voice-prefix tag (string-append "\\incipit { " current " }")) (d-DirectivePut-layout-postfix tag (string-append " incipit-width = " (number->string incipitLength) "\n")) (set! indent (d-DirectiveGet-layout-data "Indent")) (disp (number? indent) (string? indent) indent) (if (and (string? indent) (string->number indent)) (if (> incipitLength (string->number indent)) (d-Indent incipitLength)) Andreas
Re: Incipit
On Sat, 2023-12-16 at 12:39 +, Richard Shann wrote: > 2) To add a \layout {} block with the incipit indent stuff as in the > example in the docs (d-DirectivePut-layout-postfix "StaffIncipit " " incipit-width = 3\\cm ") adds the incipit-width (as given in the example in the docs) to the layout block Richard
Re: Incipit
Sorry about the typos in my previous response, I hope you got the drift. I've had a chance to look at it now and in addition to my previous comments you will need 1) to put the \incipit syntax into the Voice not the Staff (d-DirectivePut-voice-prefix tag (string-append "\\incipit { " current " }")) 2) To add a \layout {} block with the incipit indent stuff as in the example in the docs 3) To ensure an InstrumentName is set, otherwise for some reason the example doesn't do anything. 4) To choose another name for the command e.g. "StaffIncipit" as there is already a command "Incipit" which applies to the whole score. Here is you code with 1) done, as you are perhaps not going to be calling this command with a parameter I have dropped the bits of code that refer to Incipit::params ... ;;;Incipit (let ((tag "Incipit") (current "") ) (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit for current staff:") current)) (if (string? current) (begin (d-DirectivePut-voice-prefix tag (string-append "\\incipit { " current " }") HTH Richard On Sat, 2023-12-16 at 09:54 +, Richard Shann wrote: > On Fri, 2023-12-15 at 22:04 +0100, Andreas Schneider wrote: > > On 15.12.23 21:33, Richard Shann wrote: > > > On Fri, 2023-12-15 at 19:48 +0100, Andreas Schneider wrote: > > > > I'm trying to write a Scheme script for an incipit > > > > ( > > > > https://lilypond.org/doc/v2.23/Documentation/notation/working-with-anc > > > > ient-music-_002d-scenarios-and-solutions#incipits). > > > > I have started from the script for instrument name and modified > > > > it to > > > > match my needs arriving at the following: > > > > > > > > ;;;Incipit > > > > (let ((tag "Incipit") (current "") ) > > > > (if (string? Incipit::params) > > > > (begin > > > > (set! current Incipit::params) > > > > (set! Incipit::params #f))) > > > > (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit > > > > for > > > > current > > > > staff:") current)) > > > > (if (string? current) > > > > (begin > > > > (d-DirectivePut-staff-prefix tag (string-append "incipit { > > > > " > > > > current > > > > " }") > > > > (set! Incipit::params current) > > > > > > > > Unfortunately, I get a script error > > > > > > the error message ends: > > > > > > (#f Unbound variable: ~S (Incipit::params) #f) > > > Denemo - WARNING : > > > The tag is > > > > > > unbound-variable > > > > > > Which is telling you that Incipit::params in an unbound-variable. > > > This > > > variable would be created if you invoked this script via a > > > command > > > called Incipt - that is each command in the menu creates a > > > variable > > > named ::params when it is invoked (setting it to #f if its > > > invoked > > > from a menu). > > > > Thanks for your quick response. So I need to make a menu item out > > of > > it > > in order to test it. > > well you could execute (define Incipit::params #f) before trying to > execute your script. > > > > I did that and now I proceed a little bit further > > and can enter some incipit (e.g. \clef "mensural-c2" \time 3/2 d' 2 > > c' 1 > > d' 2 e' d' e'), but finally I get the error > > > > (#f Wrong number of arguments to ~A (# > d-DirectivePut-staff-prefix (_ _)>) #f) > > wrong-number-of-args > > so it is saying you have the wrong number of arguments to the > procedure > d-DirectivePut-staff-prefix which needs two: a tag (a unique name for > the directive) and a string (some LilyPond syntax to insert "before" > the staff). > > > > What do I do different than in InstrumentName? > > you have misplaced the closing parenthesis for the (d-DirectivePut- > staff-prefix tag arg) procedure. If you step the cursor back from the > end of the script you can see the matching opening parentheses for > each > ")" and you will see that the (d-DirectivePut-staff-prefix is > followed > by tag, (string-append ...) and (set! ...). This last one should be > the > second argument to the (begin ...) not a third argument to the (d- > DirectivePut-staff-prefix ...). So you need to add a ")" after the > (string-append ...) and remove it from the end of the script. > > Having said that, I can see other problems looming - the syntax you > are > emitting starts "incipit " whereas according to the docs it should be > "\incipit" which in Scheme is written £\\incipt£ (because you want a > literal "\" character). And then it will need some work to emit the > syntax at the right place - InstrumentName puts it in a \with {} > clause > by setting a (d-irectivePut-staff-override tag ...). I'll take a look > later at what override you need if any (there is a denemo score > shipped > with denemo that illustrates the various overrides available). > > Richard > > > > > > Andreas > > > >
Re: Incipit
On Fri, 2023-12-15 at 22:04 +0100, Andreas Schneider wrote: > On 15.12.23 21:33, Richard Shann wrote: > > On Fri, 2023-12-15 at 19:48 +0100, Andreas Schneider wrote: > > > I'm trying to write a Scheme script for an incipit > > > ( > > > https://lilypond.org/doc/v2.23/Documentation/notation/working-with-anc > > > ient-music-_002d-scenarios-and-solutions#incipits). > > > I have started from the script for instrument name and modified > > > it to > > > match my needs arriving at the following: > > > > > > ;;;Incipit > > > (let ((tag "Incipit") (current "") ) > > > (if (string? Incipit::params) > > > (begin > > > (set! current Incipit::params) > > > (set! Incipit::params #f))) > > > (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit for > > > current > > > staff:") current)) > > > (if (string? current) > > > (begin > > > (d-DirectivePut-staff-prefix tag (string-append "incipit { " > > > current > > > " }") > > > (set! Incipit::params current) > > > > > > Unfortunately, I get a script error > > > > the error message ends: > > > > (#f Unbound variable: ~S (Incipit::params) #f) > > Denemo - WARNING : > > The tag is > > > > unbound-variable > > > > Which is telling you that Incipit::params in an unbound-variable. > > This > > variable would be created if you invoked this script via a command > > called Incipt - that is each command in the menu creates a variable > > named ::params when it is invoked (setting it to #f if its > > invoked > > from a menu). > > Thanks for your quick response. So I need to make a menu item out of > it > in order to test it. well you could execute (define Incipit::params #f) before trying to execute your script. > I did that and now I proceed a little bit further > and can enter some incipit (e.g. \clef "mensural-c2" \time 3/2 d' 2 > c' 1 > d' 2 e' d' e'), but finally I get the error > > (#f Wrong number of arguments to ~A (# d-DirectivePut-staff-prefix (_ _)>) #f) > wrong-number-of-args so it is saying you have the wrong number of arguments to the procedure d-DirectivePut-staff-prefix which needs two: a tag (a unique name for the directive) and a string (some LilyPond syntax to insert "before" the staff). > > What do I do different than in InstrumentName? you have misplaced the closing parenthesis for the (d-DirectivePut- staff-prefix tag arg) procedure. If you step the cursor back from the end of the script you can see the matching opening parentheses for each ")" and you will see that the (d-DirectivePut-staff-prefix is followed by tag, (string-append ...) and (set! ...). This last one should be the second argument to the (begin ...) not a third argument to the (d- DirectivePut-staff-prefix ...). So you need to add a ")" after the (string-append ...) and remove it from the end of the script. Having said that, I can see other problems looming - the syntax you are emitting starts "incipit " whereas according to the docs it should be "\incipit" which in Scheme is written £\\incipt£ (because you want a literal "\" character). And then it will need some work to emit the syntax at the right place - InstrumentName puts it in a \with {} clause by setting a (d-irectivePut-staff-override tag ...). I'll take a look later at what override you need if any (there is a denemo score shipped with denemo that illustrates the various overrides available). Richard > > Andreas >
Re: Incipit
On 15.12.23 21:33, Richard Shann wrote: On Fri, 2023-12-15 at 19:48 +0100, Andreas Schneider wrote: I'm trying to write a Scheme script for an incipit ( https://lilypond.org/doc/v2.23/Documentation/notation/working-with-anc ient-music-_002d-scenarios-and-solutions#incipits). I have started from the script for instrument name and modified it to match my needs arriving at the following: ;;;Incipit (let ((tag "Incipit") (current "") ) (if (string? Incipit::params) (begin (set! current Incipit::params) (set! Incipit::params #f))) (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit for current staff:") current)) (if (string? current) (begin (d-DirectivePut-staff-prefix tag (string-append "incipit { " current " }") (set! Incipit::params current) Unfortunately, I get a script error the error message ends: (#f Unbound variable: ~S (Incipit::params) #f) Denemo - WARNING : The tag is unbound-variable Which is telling you that Incipit::params in an unbound-variable. This variable would be created if you invoked this script via a command called Incipt - that is each command in the menu creates a variable named ::params when it is invoked (setting it to #f if its invoked from a menu). Thanks for your quick response. So I need to make a menu item out of it in order to test it. I did that and now I proceed a little bit further and can enter some incipit (e.g. \clef "mensural-c2" \time 3/2 d' 2 c' 1 d' 2 e' d' e'), but finally I get the error (#f Wrong number of arguments to ~A (#) #f) wrong-number-of-args What do I do different than in InstrumentName? Andreas
Re: Incipit
On Fri, 2023-12-15 at 19:48 +0100, Andreas Schneider wrote: > I'm trying to write a Scheme script for an incipit > ( > https://lilypond.org/doc/v2.23/Documentation/notation/working-with-anc > ient-music-_002d-scenarios-and-solutions#incipits). > I have started from the script for instrument name and modified it to > match my needs arriving at the following: > > ;;;Incipit > (let ((tag "Incipit") (current "") ) > (if (string? Incipit::params) > (begin > (set! current Incipit::params) > (set! Incipit::params #f))) > (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit for > current > staff:") current)) > (if (string? current) > (begin > (d-DirectivePut-staff-prefix tag (string-append "incipit { " > current > " }") > (set! Incipit::params current) > > Unfortunately, I get a script error the error message ends: (#f Unbound variable: ~S (Incipit::params) #f) Denemo - WARNING : The tag is unbound-variable Which is telling you that Incipit::params in an unbound-variable. This variable would be created if you invoked this script via a command called Incipt - that is each command in the menu creates a variable named ::params when it is invoked (setting it to #f if its invoked from a menu). HTH Richard