[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: TupletNumber direction
From: |
Daniel Rosen |
Subject: |
RE: TupletNumber direction |
Date: |
Sun, 11 Nov 2012 22:35:16 +0000 |
I can't speak to whether the code is sound, but if it is, this should be added
to the LSR. Quite frankly, I'm surprised something similar isn't there already.
DR
-----Original Message-----
From: Thomas Morley [mailto:address@hidden
Sent: Sunday, November 11, 2012 5:32 PM
To: David Nalesnik
Cc: Daniel Rosen; David Kastrup; address@hidden
Subject: Re: TupletNumber direction
2012/11/11 David Nalesnik <address@hidden>:
> On Sun, Nov 11, 2012 at 3:36 PM, Daniel Rosen <address@hidden> wrote:
>> Fantastic. I had a feeling that it would be a relatively simple function (it
>> certainly appears to be), but I know absolutely nothing about Scheme. I'll
>> have to read the Extending manual one of these days.
>>
>
> Yes--Scheme certainly opens up a lot of possibilities, and it's great
> fun if you like solving puzzles.
Hi David,
Big surprise: I _do_ like solving puzzles. :D
On topic:
Your function doesn't cover the case, where a rest is first in a tuplet.
Try it with:
\relative c'' {
\times 2/3 { r8 c, c }
}
Here my approach, covering the rest-case and emitting a warning if kneed beam
is occurring:
\version "2.16.0"
\relative c' {
\override TupletBracket #'after-line-breaking =
#(lambda (grob)
(let* ((tuplet-dir (ly:grob-property grob 'direction))
(note-columns (ly:grob-array->list (ly:grob-object grob
'note-columns)))
(note-heads-array-list
(flatten-list
(map
(lambda (x)
(ly:grob-object x 'note-heads))
note-columns)))
(note-heads
(flatten-list
(map
(lambda (x)
(ly:grob-array->list x))
note-heads-array-list)))
(stems (map (lambda (x) (ly:grob-object x 'stem)) note-heads))
(stem-dirs (map (lambda (x) (ly:grob-property x
'direction)) stems))
(sorted-stems-dirs-list (sort-list stem-dirs (lambda (a b) (<
a b))))
(equal-stems-dir? (= (car sorted-stems-dirs-list) (car
(reverse sorted-stems-dirs-list)))))
(if (and equal-stems-dir? (= (car sorted-stems-dirs-list) tuplet-dir))
(ly:grob-set-property! grob 'direction (* -1 (car
sorted-stems-dirs-list)))
(ly:warning "Kneed beam detected - if desired, adjust TupletBracket
manually."))))
\times 2/3 { c'8 c c }
\times 2/3 { r8 c c }
\times 2/3 { r8 r c }
\times 2/3 { c c'' r }
\break
\times 2/3 { c,,,8 c c }
\times 2/3 { r8 c c }
\times 2/3 { r8 r c }
\times 2/3 { c c'' r }
}
Best,
Harm
- TupletNumber direction, Daniel Rosen, 2012/11/11
- Re: TupletNumber direction, David Kastrup, 2012/11/11
- RE: TupletNumber direction, Daniel Rosen, 2012/11/11
- RE: TupletNumber direction, Daniel Rosen, 2012/11/11
- Re: TupletNumber direction, David Kastrup, 2012/11/11
- Re: TupletNumber direction, David Nalesnik, 2012/11/11
- RE: TupletNumber direction, Daniel Rosen, 2012/11/11
- Re: TupletNumber direction, David Nalesnik, 2012/11/11
- Re: TupletNumber direction, Thomas Morley, 2012/11/11
- RE: TupletNumber direction,
Daniel Rosen <=
- Re: TupletNumber direction, Thomas Morley, 2012/11/11
- RE: TupletNumber direction, Daniel Rosen, 2012/11/11
- Re: TupletNumber direction, David Kastrup, 2012/11/12
- RE: TupletNumber direction, Daniel Rosen, 2012/11/13