\ottava without bracket
Hi, This is probably easy, but I couldn't find the answer. How to do an \ottava without a bracket, that only applies to one single note or chord? -- MT ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \ottava without bracket
Hi Martin, I used \ottava #0 and it worked, albeit that there still is a very short bracket and only "8", not "8va". HTH Best, Robert Blackstone On 27 Feb 2017, at 13:42 , Martin Tarenskeen wrote: > > Hi, > > This is probably easy, but I couldn't find the answer. How to do an \ottava > without a bracket, that only applies to one single note or chord? > > -- > > MT > > ___ > lilypond-user mailing list > lilypond-user@gnu.org > https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \ottava without bracket
On Mon, Feb 27, 2017 at 8:04 AM, David Nalesnik wrote: > On Mon, Feb 27, 2017 at 7:00 AM, Robert Blackstone > wrote: >> Hi Martin, >> >> I used \ottava #0 and it worked, albeit that there still is a very short >> bracket and only "8", not "8va". >> >> HTH >> >> >> Best, >> Robert Blackstone >> >> On 27 Feb 2017, at 13:42 , Martin Tarenskeen wrote: >> >>> >>> Hi, >>> >>> This is probably easy, but I couldn't find the answer. How to do an \ottava >>> without a bracket, that only applies to one single note or chord? >>> > > Try > > \override Staff.OttavaBracket.style = #'none Of course, there should be an option to automatically hide the bracket only on single notes, leaving it for longer stretches. David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \ottava without bracket
On Mon, Feb 27, 2017 at 7:00 AM, Robert Blackstone wrote: > Hi Martin, > > I used \ottava #0 and it worked, albeit that there still is a very short > bracket and only "8", not "8va". > > HTH > > > Best, > Robert Blackstone > > On 27 Feb 2017, at 13:42 , Martin Tarenskeen wrote: > >> >> Hi, >> >> This is probably easy, but I couldn't find the answer. How to do an \ottava >> without a bracket, that only applies to one single note or chord? >> Try \override Staff.OttavaBracket.style = #'none -David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \ottava without bracket
On Mon, Feb 27, 2017 at 8:13 AM, David Nalesnik wrote: > On Mon, Feb 27, 2017 at 8:04 AM, David Nalesnik > wrote: >> On Mon, Feb 27, 2017 at 7:00 AM, Robert Blackstone >> wrote: >>> Hi Martin, >>> >>> I used \ottava #0 and it worked, albeit that there still is a very short >>> bracket and only "8", not "8va". >>> >>> HTH >>> >>> >>> Best, >>> Robert Blackstone >>> >>> On 27 Feb 2017, at 13:42 , Martin Tarenskeen wrote: >>> Hi, This is probably easy, but I couldn't find the answer. How to do an \ottava without a bracket, that only applies to one single note or chord? >> >> Try >> >> \override Staff.OttavaBracket.style = #'none > > Of course, there should be an option to automatically hide the bracket > only on single notes, leaving it for longer stretches. > Something like this possibly: \version "2.19.55" #(define (no-bracket-for-singles grob) (if (eq? (ly:spanner-bound grob LEFT) (ly:spanner-bound grob RIGHT)) 'none 'dashed-line)) { \override Staff.OttavaBracket.style = #no-bracket-for-singles \ottava #1 c'' \ottava #0 d'' e'' f'' \ottava #1 c'' d'' \ottava #0 e'' f'' } % The issue here is that the "8va" ought be centered over the note. Style "none" doesn't affect the positioning of the text. Probably this would mean writing a stencil callback (instead of one for 'style). I'll look at this later, in case someone hasn't beaten me to it :) David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \ottava without bracket
On Mon, Feb 27, 2017 at 8:54 AM, David Nalesnik wrote: > On Mon, Feb 27, 2017 at 8:13 AM, David Nalesnik > wrote: >> On Mon, Feb 27, 2017 at 8:04 AM, David Nalesnik >> wrote: >>> On Mon, Feb 27, 2017 at 7:00 AM, Robert Blackstone >>> wrote: Hi Martin, I used \ottava #0 and it worked, albeit that there still is a very short bracket and only "8", not "8va". HTH Best, Robert Blackstone On 27 Feb 2017, at 13:42 , Martin Tarenskeen wrote: > > Hi, > > This is probably easy, but I couldn't find the answer. How to do an > \ottava without a bracket, that only applies to one single note or chord? > >>> >>> Try >>> >>> \override Staff.OttavaBracket.style = #'none >> >> Of course, there should be an option to automatically hide the bracket >> only on single notes, leaving it for longer stretches. >> > > Something like this possibly: > > \version "2.19.55" > > #(define (no-bracket-for-singles grob) >(if (eq? (ly:spanner-bound grob LEFT) > (ly:spanner-bound grob RIGHT)) >'none >'dashed-line)) > > { > \override Staff.OttavaBracket.style = #no-bracket-for-singles > \ottava #1 c'' \ottava #0 d'' e'' f'' > \ottava #1 c'' d'' \ottava #0 e'' f'' > } > > % > > The issue here is that the "8va" ought be centered over the note. > Style "none" doesn't affect the positioning of the text. > > Probably this would mean writing a stencil callback (instead of one > for 'style). I'll look at this later, in case someone hasn't beaten > me to it :) > Positioning fixed: \version "2.19.55" #(define (my-proc grob) (let ((default-stil (ly:ottava-bracket::print grob)) (lb (ly:spanner-bound grob LEFT))) (if (eq? lb (ly:spanner-bound grob RIGHT)) (let* ((txt (ly:grob-property grob 'text)) (txt-stil (grob-interpret-markup grob txt)) (txt-stil (ly:stencil-aligned-to txt-stil X CENTER)) (sys (ly:grob-system grob)) (lb-center (interval-center (ly:grob-extent lb lb X (ly:stencil-translate-axis txt-stil lb-center X)) default-stil))) { \override Staff.OttavaBracket.stencil = #my-proc \ottava #1 c'''1 \ottava #2 c1 \ottava #-1 c''1 \ottava #-2 c'1 \ottava #1 1 \ottava #2 1 \ottava #-1 1 \ottava #-2 1 \ottava #1 1 \ottava #2 1 \ottava #-1 1 \ottava #-2 1 \time 3/4 \ottava #1 c'''2. \ottava #2 c2. \ottava #-1 c''2. \ottava #-2 c'2. \ottava #1 2. \ottava #2 2. \ottava #-1 2. \ottava #-2 2. \ottava #1 2. \ottava #2 2. \ottava #-1 2. \ottava #-2 2. \time 4/4 \ottava #1 c'''2 d''' \ottava #2 c2 d \ottava #-1 c''2 d'' \ottava #-2 c'2 d' \ottava #1 c'''1 \break c'''1 } HTH, David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \ottava without bracket
Hi David, This is excellent and useful. Also works, of course, when using something like \set Staff.ottavation = "8". Why not make this a snippet in LSR? Andrew ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \ottava without bracket
Hi Andrew, On Mon, Feb 27, 2017 at 6:52 PM, Andrew Bernard wrote: > Hi David, > > This is excellent and useful. Also works, of course, when using something > like \set Staff.ottavation = "8". > > Why not make this a snippet in LSR? > Sure, I will look it at some more, and submit. Ideally, I'd like to add something to the codebase. Best, David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \ottava without bracket
On Tue, Feb 28, 2017 at 10:09 AM, David Nalesnik wrote: > Hi Andrew, > > On Mon, Feb 27, 2017 at 6:52 PM, Andrew Bernard > wrote: >> Hi David, >> >> This is excellent and useful. Also works, of course, when using something >> like \set Staff.ottavation = "8". >> >> Why not make this a snippet in LSR? >> > > Sure, I will look it at some more, and submit. > > Ideally, I'd like to add something to the codebase. > A question: what is the expected behavior when an ottava crosses a line break? The code above will always print a bracket, for such a continuation. David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \ottava without bracket
2017-02-28 16:09 GMT+00:00 David Nalesnik : > Hi Andrew, > > On Mon, Feb 27, 2017 at 6:52 PM, Andrew Bernard > wrote: >> Hi David, >> >> This is excellent and useful. Also works, of course, when using something >> like \set Staff.ottavation = "8". >> >> Why not make this a snippet in LSR? >> > > Sure, I will look it at some more, and submit. > > Ideally, I'd like to add something to the codebase. > > Best, > David Hi David, I was working on a patch introducing ottavaText as a context-property. Maybe we could coordinate or at least avoid doing work twice. I'll attach what I've done so far. It's not finished yet: I'd like to polish it and add entries in NR and Changes, probably worth a regtest as well. Cheers, Harm P.S. Did you notice https://sourceforge.net/p/testlilyissues/issues/5064/#23bb ? From dfa574353db72775a028f172da6f5c5009c5f69d Mon Sep 17 00:00:00 2001 From: Thomas Morley Date: Tue, 28 Feb 2017 18:48:27 + Subject: [PATCH] Introduce context-property ottavaText --- ly/engraver-init.ly | 7 +++ scm/define-context-properties.scm | 2 ++ scm/define-music-callbacks.scm| 13 +++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 693f9eb..41665df 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -768,6 +768,13 @@ automatically when an output definition (a @code{\\score} or topLevelAlignment = ##t timing = ##t + + ottavaText = +#'((2 . "15ma") + (1 . "8va") + (0 . #f) + (-1 . "8vb") + (-2 . "15mb")) } diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index 75f1807..dd362fe 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -494,6 +494,8 @@ any effect the note would have had on accidentals in other voices.") (ottavation ,markup? "If set, the text for an ottava spanner. Changing this creates a new text spanner.") + (ottavaText ,list? "An alist containing pairs of ottava-number and markup. +Used to get the text for @code{OttavaBracket}.") (output ,ly:music-output? "The output produced by a score-level translator during music interpretation.") diff --git a/scm/define-music-callbacks.scm b/scm/define-music-callbacks.scm index 5cc1db1..d8150cb 100644 --- a/scm/define-music-callbacks.scm +++ b/scm/define-music-callbacks.scm @@ -77,12 +77,13 @@ to be used by the sequential-iterator" (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") + (let* ((offset (* -7 octavation)) + (ottava-label-list + (ly:context-property context 'ottavaText)) + (string + (if (pair? ottava-label-list) + (assoc-get octavation ottava-label-list) + #f))) (set! (ly:context-property context 'middleCOffset) offset) (set! (ly:context-property context 'ottavation) string) (ly:set-middle-C! context -- 2.1.4 ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \ottava without bracket
Hi Harm, On Tue, Feb 28, 2017 at 1:02 PM, Thomas Morley wrote: > 2017-02-28 16:09 GMT+00:00 David Nalesnik : >> Hi Andrew, >> >> On Mon, Feb 27, 2017 at 6:52 PM, Andrew Bernard >> wrote: >>> Hi David, >>> >>> This is excellent and useful. Also works, of course, when using something >>> like \set Staff.ottavation = "8". >>> >>> Why not make this a snippet in LSR? >>> >> >> Sure, I will look it at some more, and submit. >> >> Ideally, I'd like to add something to the codebase. >> >> Best, >> David > > > Hi David, > > I was working on a patch introducing ottavaText as a context-property. > Maybe we could coordinate or at least avoid doing work twice. I don't think this would conflict with anything I may try. I'd just be modifying the print function. > > I'll attach what I've done so far. > It's not finished yet: I'd like to polish it and add entries in NR and > Changes, probably worth a regtest as well. > Sure, go ahead! It will be much more convenient storing texts in a context property. There's a comment in lily/ottava-bracket.cc about the desirability of being able to switch between longer and shorter texts based on available space: Maybe that could be part of the overall plan. > > P.S. > Did you notice > https://sourceforge.net/p/testlilyissues/issues/5064/#23bb > ? No, I hadn't seen it. Thanks for pointing this out to me! I'm not certain what the best way to fix this is. (I added a comment to the issue tracker.) Best, David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \ottava without bracket
On 2/28/17, David Nalesnik wrote: > Hi Harm, > > On Tue, Feb 28, 2017 at 1:02 PM, Thomas Morley > wrote: >> 2017-02-28 16:09 GMT+00:00 David Nalesnik : >>> Hi Andrew, >>> >>> On Mon, Feb 27, 2017 at 6:52 PM, Andrew Bernard >>> wrote: Hi David, This is excellent and useful. Also works, of course, when using something like \set Staff.ottavation = "8". Why not make this a snippet in LSR? >>> >>> Sure, I will look it at some more, and submit. >>> >>> Ideally, I'd like to add something to the codebase. >>> >>> Best, >>> David >> >> >> Hi David, >> >> I was working on a patch introducing ottavaText as a context-property. >> Maybe we could coordinate or at least avoid doing work twice. > > I don't think this would conflict with anything I may try. I'd just > be modifying the print function. >> >> I'll attach what I've done so far. >> It's not finished yet: I'd like to polish it and add entries in NR and >> Changes, probably worth a regtest as well. >> > > Sure, go ahead! It will be much more convenient storing texts in a > context property. > > There's a comment in lily/ottava-bracket.cc about the desirability of > being able to switch between longer and shorter texts based on > available space: Maybe that could be part of the overall plan. > Harm, I've attached the sort of patch I have in mind. (Regtests and changes entry needed as well.) There's an example file to show how it works, including at line breaks. I don't think this would interfere with your work, but let me know otherwise! Best, David From f7d159a1db04e3847ecee715578f2b17ccfc7fde Mon Sep 17 00:00:00 2001 From: David Nalesnik Date: Wed, 1 Mar 2017 10:48:54 -0600 Subject: [PATCH] Hide brackets on single-note ottavas This patch introduces the property "no-bracket-for-singleton," which when set to #t prints an ottava text without bracket for single notes. The ottava text is centered on the note-column. (This is not the case when hiding the bracket by setting OttavaBracket.style to 'none, which preserves the bracketed position.) When an ottava is broken, all "singletons" will be bracketed except one ending the spanner. --- lily/ottava-bracket.cc | 14 ++ scm/define-grob-properties.scm | 2 ++ 2 files changed, 16 insertions(+) diff --git a/lily/ottava-bracket.cc b/lily/ottava-bracket.cc index 63a9d3e..2125ffc 100644 --- a/lily/ottava-bracket.cc +++ b/lily/ottava-bracket.cc @@ -84,6 +84,19 @@ Ottava_bracket::print (SCM smob) Drul_array shorten = robust_scm2interval (me->get_property ("shorten-pair"), Interval (0, 0)); + extract_grob_set (me, "side-support-elements", sse); + + if (to_boolean (me->get_property ("no-bracket-for-singleton")) && + sse.size () == 1 && !broken[RIGHT]) { +Grob *elt = sse[0]; +Interval elt_ext = elt->extent (common, X_AXIS); +text.align_to (X_AXIS, CENTER); +text.align_to (Y_AXIS, CENTER); +text.translate_axis (elt_ext.center (), X_AXIS); +text.translate_axis (- me->relative_coordinate (common, X_AXIS), X_AXIS); +return text.smobbed_copy (); + } + /* TODO: we should check if there are ledgers, and modify length of the spanner to that. @@ -191,6 +204,7 @@ ADD_INTERFACE (Ottava_bracket, /* properties */ "edge-height " "bracket-flare " + "no-bracket-for-singleton " "shorten-pair " "minimum-length " ); diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index e950d53..e126cc4 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -671,6 +671,8 @@ syllable following an extender).") (no-alignment ,boolean? "If set, don't place this grob in a @code{VerticalAlignment}; rather, place it using its own @code{Y-offset} callback.") + (no-bracket-for-singleton ,boolean? "Do not print a bracket for +ottavas spanning a single note.") (no-ledgers ,boolean? "If set, don't draw ledger lines on this object.") (no-stem-extend ,boolean? "If set, notes with ledger lines do not -- 2.1.4 \version "2.19.55" #(define (my-proc grob) (let ((default-stil (ly:ottava-bracket::print grob)) (lb (ly:spanner-bound grob LEFT))) (if (eq? lb (ly:spanner-bound grob RIGHT)) (let* ((txt (ly:grob-property grob 'text)) (txt-stil (grob-interpret-markup grob txt)) (txt-stil (ly:stencil-aligned-to txt-stil X CENTER)) (lb-center (interval-center (ly:grob-extent lb lb X (ly:stencil-translate-axis txt-stil lb-center X)) default-stil))) #(define (my-proc2 grob) (let* ((ncs (ly:grob-object grob 'side-support-elements)) (ncs (ly:grob-array->list ncs))) (if (> (length ncs) 1) ;; Return default stencil (ly:ottava-bracket::print grob) (let* ((txt (ly:grob-pr
Re: \ottava without bracket
On Wed, Mar 1, 2017 at 11:08 AM, David Nalesnik wrote: > On 2/28/17, David Nalesnik wrote: >> Hi Harm, >> >> On Tue, Feb 28, 2017 at 1:02 PM, Thomas Morley >> wrote: >>> 2017-02-28 16:09 GMT+00:00 David Nalesnik : Hi Andrew, On Mon, Feb 27, 2017 at 6:52 PM, Andrew Bernard wrote: > Hi David, > > This is excellent and useful. Also works, of course, when using > something > like \set Staff.ottavation = "8". > > Why not make this a snippet in LSR? > Sure, I will look it at some more, and submit. Ideally, I'd like to add something to the codebase. Best, David >>> >>> >>> Hi David, >>> >>> I was working on a patch introducing ottavaText as a context-property. >>> Maybe we could coordinate or at least avoid doing work twice. >> >> I don't think this would conflict with anything I may try. I'd just >> be modifying the print function. >>> >>> I'll attach what I've done so far. >>> It's not finished yet: I'd like to polish it and add entries in NR and >>> Changes, probably worth a regtest as well. >>> >> >> Sure, go ahead! It will be much more convenient storing texts in a >> context property. >> >> There's a comment in lily/ottava-bracket.cc about the desirability of >> being able to switch between longer and shorter texts based on >> available space: Maybe that could be part of the overall plan. >> > > Harm, > > I've attached the sort of patch I have in mind. (Regtests and changes > entry needed as well.) > > There's an example file to show how it works, including at line breaks. > (There's some Scheme stuff in the example file that I forgot to delete.) ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user