denemo-devel
[Top][All Lists]
Advanced

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

Re: Incipit


From: Richard Shann
Subject: Re: Incipit
Date: Sat, 16 Dec 2023 12:39:28 +0000
User-agent: Evolution 3.46.4-2

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 +0000, 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 xxxx::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 (#<procedure
> > 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
> > 
> 
> 




reply via email to

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