denemo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Incipit


From: Andreas Schneider
Subject: Re: Incipit
Date: Sun, 4 Feb 2024 10:41:22 +0100
User-agent: Mozilla Thunderbird

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 +0000, 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]