lilypond-user
[Top][All Lists]
Advanced

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

Re: \ottava without bracket


From: David Nalesnik
Subject: Re: \ottava without bracket
Date: Mon, 27 Feb 2017 18:15:03 -0600

On Mon, Feb 27, 2017 at 8:54 AM, David Nalesnik
<address@hidden> wrote:
> On Mon, Feb 27, 2017 at 8:13 AM, David Nalesnik
> <address@hidden> wrote:
>> On Mon, Feb 27, 2017 at 8:04 AM, David Nalesnik
>> <address@hidden> wrote:
>>> On Mon, Feb 27, 2017 at 7:00 AM, Robert Blackstone
>>> <address@hidden> 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 <address@hidden> 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 c''''1
  \ottava #-1 c''1
  \ottava #-2 c'1
  \ottava #1 <c''' d''' e''' f'''>1
  \ottava #2 <c'''' d'''' e'''' f''''>1
  \ottava #-1 <c'' d'' e'' f''>1
  \ottava #-2 <c' d' e' f'>1
  \ottava #1 <cis''' dis''' eis''' fis'''>1
  \ottava #2 <cis'''' dis'''' eis'''' fis''''>1
  \ottava #-1 <cis'' dis'' eis'' fis''>1
  \ottava #-2 <cis' dis' eis' fis'>1
  \time 3/4
  \ottava #1 c'''2.
  \ottava #2 c''''2.
  \ottava #-1 c''2.
  \ottava #-2 c'2.
  \ottava #1 <c''' d''' e''' f'''>2.
  \ottava #2 <c'''' d'''' e'''' f''''>2.
  \ottava #-1 <c'' d'' e'' f''>2.
  \ottava #-2 <c' d' e' f'>2.
  \ottava #1 <cis''' dis''' eis''' fis'''>2.
  \ottava #2 <cis'''' dis'''' eis'''' fis''''>2.
  \ottava #-1 <cis'' dis'' eis'' fis''>2.
  \ottava #-2 <cis' dis' eis' fis'>2.
  \time 4/4
  \ottava #1 c'''2 d'''
  \ottava #2 c''''2 d''''
  \ottava #-1 c''2 d''
  \ottava #-2 c'2 d'
  \ottava #1 c'''1 \break
  c'''1
}

%%%%

HTH,

David



reply via email to

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