Hi, as I got quite a few similar responses I'll reply at once.
All the suggestions that manually set Staff.ottavation don't work because I want something that can be defined in a stylesheet without the user having to change the music content (by manually setting the ottava text for each case). So Joram's function is the only that would satisfy my needs, but then I'm already happy with the solution I had come up with in my initial post. So obviously there is no simpler solution available. What I would actually like to have is a property that can hold a list of strings to be used for the different octaves, so you could write \override Staff.OttavaBracket.labels = #'((2 . "16") ; (used by some publishers) (1 . "8") (0 . #f) (-1 . "8") (-2 . "16")) The following code (from define-music-callbacks.scm) is obviously responsible for producing the octavation. If someone could tell me how this can read a property from Staff.OttavaBracket from within the function I think I could make the ottava text configurable in LilyPond. (define (make-ottava-set music) "Set context properties for an ottava bracket." (let ((octavation (ly:music-property music 'ottava-number))) (list (context-spec-music (make-apply-context (lambda (context) (let ((offset (* -7 octavation)) (string (assoc-get octavation '((2 . "15ma") (1 . "8va") (0 . #f) (-1 . "8vb") (-2 . "15mb"))))) (set! (ly:context-property context 'middleCOffset) offset) (set! (ly:context-property context 'ottavation) string) (ly:set-middle-C! context)))) 'Staff)))) Urs Am 15.02.2017 um 21:06 schrieb Urs Liska: > Hi all, > > is it really true that the text of the OttavaBracket can't be > customized? All I could find was the doc snippet > http://lilypond.org/doc/v2.19/Documentation/snippets/text#text-ottava-text > which suggests to manually set Staff.ottavation after the \ottava command. > > With this I created a function (overwriting the built-in function) > > #(define ottava > (let ((orig-ottava ottava) > (numbers '("15" "8" "" "8" "15"))) > (define-music-function (oct)(integer?) > #{ > #(orig-ottava oct) > #(if (not (= oct 0)) > #{ > \set Staff.ottavation = #(list-ref numbers (+ oct 2)) > #}) > #}))) > > > which actually does what I want (change "8va" to "8"), but I can't > believe that it is really necessary to go that long way for a seemingly > simple task. > > Any comments? > Urs > -- u...@openlilylib.org https://openlilylib.org http://lilypondblog.org _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user