[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: overriding the order of accidentals in a chord
From: |
Kieren MacMillan |
Subject: |
Re: overriding the order of accidentals in a chord |
Date: |
Wed, 19 Oct 2011 18:34:46 -0400 |
Hi Thomas,
> I'm not aware of any easy method to do so. But are you sure you want to? In
> the following I did it manually, and I don't like the output:
Yes, that example doesn't look great… but here's a more compelling (to me)
snippet:
\version "2.15.14"
\language "english"
\relative a' { <a b ds fss b>2\arpeggio }
#(define (offset-accidental note-grob x-value)
(let ((accidental (ly:grob-object note-grob 'accidental-grob)))
(if (not (null? accidental))
(ly:grob-set-property! accidental 'extra-offset (cons x-value 0)))))
accTw =
#(define-music-function (parser location x-offset music) (number? ly:music?)
(set! (ly:music-property music 'tweaks)
(acons 'before-line-breaking (lambda (grob) (offset-accidental grob
x-offset))
(ly:music-property music 'tweaks)))
music)
%------- Test
\relative a' {
\override Arpeggio #'X-extent = #'(-0.25 . -0.2) <a b \accTw #-0.2 ds \accTw
#2.4 fss b>2\arpeggio
}
Without the tweak, the space before the note (which, in this case, is the
downbeat of a measure) is extremely large — as a result, the other parts in the
score look awful (with a huge blank space before the first note).
Thanks!
Kieren.
>
> \version "2.14.2"
>
> #(define (offset-accidental note-grob x-value)
> (let ((accidental (ly:grob-object note-grob 'accidental-grob)))
> (if (not (null? accidental))
> (ly:grob-set-property! accidental 'extra-offset (cons x-value 0)))))
>
> accTw =
> #(define-music-function (parser location x-offset music) (number? ly:music?)
> (set! (ly:music-property music 'tweaks)
> (acons 'before-line-breaking (lambda (grob) (offset-accidental grob
> x-offset))
> (ly:music-property music 'tweaks)))
> music)
>
> %------- Test
>
> \relative dis {
> \clef bass <\accTw #1.2 dis! \accTw #-1 a'! b>
> }
>
> Cheers,
> Harm