lilypond-user
[Top][All Lists]
Advanced

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

Re: Automatic ottava handling


From: David Nalesnik
Subject: Re: Automatic ottava handling
Date: Wed, 22 Oct 2014 08:45:18 -0500

Gilberto,

On Wed, Oct 22, 2014 at 4:39 AM, Gilberto Agostinho <address@hidden> wrote:
Hi David,

This new version is really excellent! I think it handles chords wonderfully
well, and I also like the alist idea very much!

Great--good to hear!
 


David Nalesnik-2 wrote
> The alist argument needs to be there.  I don't believe you can have an
> optional parameter except at the tail end of the music function, but I'll
> need to verify that. (And you definitely don't want the variable coming
> after the music _expression_....)

That's indeed a pity, I often forget that the music _expression_ itself is
considered as a variable in these functions, so you really can't have an
optional argument in between. But the empty alist is not a bad solution at
all, I think, and it is wonderful to have the possibility to deal with bass
clefs and short/long ottavation names.

This is indeed my mistake.  There is no such requirement for optional parameters.
To make the parameter for the alist-variable optional, you need only make a simple change to the list of predicates in the definition of ottavate:

ottavate =
#(define-music-function (parser location upper lower options mus)
   (number-pair? number-pair? (list? '()) ly:music?)

Then, you are able to write

{
  \ottavate #'(3 . 6) #'(-3 . -6) { ... }
}

or, if you like

{
  \ottavate #'(3 . 6) #'(-3 . -6) \default { ... }
}

and the function will use the default values for "options"--here, the empty list '(), which will select the default values for all of the various symbols--well, the two that are provided now: opening-clef and name-style.


As for that idea of handling rests, how difficult would it be to implement
it as another variable inside of this alist? So the user would inform how
many quarter note rests (or some other time unit) in between two "ottaved"
notes would be necessary in order to break the ottavation. I don't know how
tricky this can be (I have no clue how difficult it would be to deal with
the number of quarter notes/beats/time units/bars between notes in
LilyPond).

I can add any number of symbols to the alist, and one representing length of rests.  But this (and any smart analysis of pitch groupings) requires collecting them, which is the big stumbling block for me at the moment.  Well, I should say it is probably going to require a big rewrite.  I'll keep you posted.

Best,
David 

reply via email to

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