denemo-devel
[Top][All Lists]
Advanced

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

Re: Analysis brackets (with labels) in Denemo


From: Richard Shann
Subject: Re: Analysis brackets (with labels) in Denemo
Date: Fri, 22 Oct 2021 17:46:49 +0100

On Fri, 2021-10-22 at 18:52 +0300, Lib Lists wrote:
> eece
> 
> On Fri, 22 Oct 2021 at 18:20, Richard Shann <richard@rshann.plus.com>
> wrote:
> > 
> > On Fri, 2021-10-22 at 16:18 +0300, Lib Lists wrote:
> > > Hi Richard,
> > > 
> > > > > 2. (picture Denemo2.png)
> > > > > I used the your code, the one with
> > > > >  (d-DirectivePut-standalone-display tag "This will label the
> > > > > Denemo
> > > > > Directive")
> > > > >  (d-DirectivePut-standalone-tx tag 20)
> > > > >  (d-DirectivePut-standalone-ty tag -20)
> > > > > and as you can see from the picture it shows four 'Directive'
> > > > > signs
> > > > > (sorry I won't know yet how those are called in Denemo). Is
> > > > > this
> > > > > the
> > > > > expected behaviour?
> > > > 
> > > > Sorry, yes I should have put (d-MoveCursorLeft) after the first
> > > > command
> > > > as it creates the Denemo Directive and moves to the right
> > > > straight
> > > > away, so that the subsequent commands create new directives
> > > > instead
> > > > of
> > > > editing the old one. There is a wrapper function that does a
> > > > whole
> > > > bunch of this for you called (StandAloneDirectiveProto ...)
> > > > which
> > > > is
> > > > used in the script for that InsertStandaloneDirective command I
> > > > referenced above. But to keep things simple:
> > > > 
> > > >  (d-DirectivePut-standalone-display tag "This will label the
> > > > Denemo
> > > > Directive")
> > > >  (d-MoveCursorLeft)
> > > >  (d-DirectivePut-standalone-tx tag 20)
> > > >  (d-DirectivePut-standalone-ty tag -20)
> > > > 
> > > > would do the trick (the subsequent d-DirectivePut-... are
> > > > editing
> > > > so
> > > > they don't move the cursor right, the cursor always moves right
> > > > after
> > > > inserting an object).
> > > 
> > > I changed the code and I now get two Directive symbols (see
> > > attached
> > > screenshot), is that correct?
> > 
> > Sorry I was a bit too terse, here is your code commented
> > 
> > > ;start analysis bracket
> > > (let ((tag "Analysis"))
> > >  (d-DirectivePut-standalone-postfix tag "\\startGroup")
> > 
> > this inserts a standalone Denemo Directive object before the cursor
> > (assuming the cursor is not already on one with that tag) and moves
> > the
> > cursor right for the next insertion.
> > 
> > >  (d-DirectivePut-standalone-display tag "Start Analysis Bracket
> > > DOWN")
> > 
> > the cursor is on the note now so this inserts a *second* Denemo
> > Directive which just displays the label, and moves the cursor right
> > 
> > >  (d-MoveCursorLeft)
> > 
> > this moves the cursor left so it is on that second Denemo
> > Directive, so
> > now it is ready to be edited
> > >  (d-DirectivePut-standalone-tx tag 20)
> > 
> > this edits that second one, filling in the tx field, positioning
> > your
> > label displaced by 20 staff spaces leftwards, it doesn't move the
> > cursor as it is editing not inserting.
> > 
> > >  (d-DirectivePut-standalone-ty tag -20)
> > 
> > likewise edits for the y position of the label
> > 
> > >  (d-DirectivePut-layout-postfix
> > > "Analysis" "  \\context {\\Voice  \\consists
> > > \"Horizontal_bracket_engraver\" }"))
> > 
> > this puts a Denemo Directive into the layout block of the movement
> > (it
> > doesn't matter where the cursor is as this is not a standalone
> > directive). You can look in the Movement->Movement Properties
> > Editor
> > and see that this directive has appeared in the layout directives.
> > 
> > So your code should have been:
> > 
> > ;start analysis bracket
> > (let ((tag "Analysis"))
> >  (d-DirectivePut-standalone-postfix tag "\\startGroup")
> >  (d-MoveCursorLeft)
> >  (d-DirectivePut-standalone-display tag "Start Analysis Bracket
> > DOWN")
> >  (d-DirectivePut-standalone-tx tag 20)
> >  (d-DirectivePut-standalone-ty tag -20)
> >  (d-DirectivePut-layout-postfix
> > "Analysis" "  \\context {\\Voice  \\consists
> > \"Horizontal_bracket_engraver\" }"))
> > 
> > where the move left into the editing position is one line earlier.
> > 
> > But you probably don't want such a long label and you perhaps don't
> > want to alter the default position of the label, so you could write
> > 
> > ;start analysis bracket
> > (let ((tag "Analysis"))
> >  (d-DirectivePut-standalone-postfix tag "\\startGroup")
> >  (d-MoveCursorLeft)
> >  (d-DirectivePut-standalone-display tag "Analysis___")
> >  (d-DirectivePut-layout-postfix
> > "Analysis" "  \\context {\\Voice  \\consists
> > \"Horizontal_bracket_engraver\" }"))
> > 
> > where I've made the label shorter and omitted the tx and ty lines
> > as
> > they were just examples to play with, the default is usually ok.
> > 
> > HTH
> > 
> > Richard
> 
> Awesome, thank you once again! Now it is fully clear.
> A side question about scripts. Every time I modify a script (and I
> assume I create one) and I save the denemo file

If you want to save your script you can use the File menu of the Scheme
window or if you want to use it in future scores you could put it into
a palette button (or create a command in the menu system that executes
it)

> , I get the warning
> 'You have a script defined, and the choice between Normal Save and
> Advanced: Execute the script etc.
> I always press Normal Save, but I'd like to understand what the other
> option means and when it should be used.

The other option you are being offered is:

"Advanced: Execute the script every time this file is opened?"

So with your script this would mean that when you re-opened the file
Denemo would insert a "Analysis" at the cursor position - not a useful
thing to do! 
What you can do with this feature is to put things like
(d-Play)
in there so that it starts to play when you load the score.
A more useful example - something I use for my own compositions is
to save the score with this script:

(d-MidiInListening)

That starts off with the MIDI keyboard set to just play rather than
edit the score - it means I can play around with melody ideas and only
turn on editing when I'm ready to write.

There is documentation for this feature at section 30.13 (use Fn1 for
your local version or the (rather crippled) online version is at 

http://git.savannah.gnu.org/gitweb/?p=denemo.git;a=blob_plain;f=docs/denemo-manual.html;hb=HEAD#toc-Subsection-30.13


HTH

Richard






reply via email to

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