[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: arpeggioArrowUp
From: |
Thomas Morley |
Subject: |
Re: arpeggioArrowUp |
Date: |
Sat, 17 Jan 2015 02:03:47 +0100 |
2015-01-17 1:59 GMT+01:00 Thomas Morley <address@hidden>:
> 2015-01-16 1:42 GMT+01:00 Thomas Morley <address@hidden>:
>> 2015-01-16 0:26 GMT+01:00 Thomas Morley <address@hidden>:
>>> 2015-01-15 15:02 GMT+01:00 tisimst <address@hidden>:
>>>> On Wed, Jan 14, 2015 at 11:47 PM, Schneidy [via Lilypond] <[hidden email]>
>>>> wrote:
>>>>
>>>> Hi Harm,
>>>>
>>>> 2015-01-15 3:22 GMT+01:00 Thomas Morley <[hidden email]>:
>>>>
>>>>>
>>>>> foo =
>>>>> #(define-music-function (parser location mus)(ly:music?)
>>>>> (music-map
>>>>> (lambda (m)
>>>>> (if (music-is-of-type? m 'arpeggio-event)
>>>>> (make-music
>>>>> 'ArpeggioEvent
>>>>> 'tweaks
>>>>> (list
>>>>> (cons 'arpeggio-direction
>>>>> (ly:music-property m 'direction))))
>>>>> m))
>>>>> mus))
>>>>>
>>>>>
>>>>> \foo
>>>>> \relative c'' {
>>>>> \mark "sort of post-processing"
>>>>> <g b d g>4\arpeggio
>>>>> <g b d g>4^\arpeggio
>>>>> <g b d g>4_\arpeggio
>>>>> }
>>>>
>>>>
>>>> I like this one.
>>>> Cheers,
>>>> Pierre
>>>>
>>>>
>>>> +1!
>>>>
>>>> However, I'd rather not have to use another function (\foo) to do this.
>>>> Otherwise, I don't think there's any benefit over what is currently
>>>> required
>>>> with \arpeggioArrowUp. Can't it be put directly into a command that
>>>> supports
>>>> the direction indicators? I can't seem to find in the documentation where
>>>> the post-fix syntax is described.
>>>>
>>>> -Abraham
>>>
>>>
>>>
>>> The direction indicators _ and ^ are setting the 'direction, as their
>>> name suggests ;).
>>> Though the arpeggio-arrow is printed, if the _'arpeggio-direction_ is set!
>>> Currently those are two different things. It may be discussable, if it
>>> _should_ be this way, but it has some logic, if you think about it.
>>> Nevertheless my 'foo'-function iterated through the music, setting
>>> 'arpeggio-direction to the value of 'direction.
>>> This is not very cheap, maybe better to use an engraver for this duty:
>>>
>>> \version "2.19.15"
>>>
>>> direction-to-arpeggio-direction-engraver =
>>> #(lambda (context)
>>> (let ((dir '()))
>>> `((listeners
>>> (arpeggio-event
>>> .
>>> ,(lambda (engraver event)
>>> ;; Not sure about following 'set!'
>>> ;; Is it save?
>>> (set! dir (ly:event-property event 'direction)))))
>>> (acknowledgers
>>> (arpeggio-interface
>>> .
>>> ,(lambda (engraver grob source-engraver)
>>> (set! (ly:grob-property grob 'arpeggio-direction) dir)
>>> (set! dir '())))))))
>>>
>>
>>
>>
>> %% c/p error, here the whole example:
>>
>> %%%%%%%%%%%%%%%%%%%%
>> %% EXAMPLE
>> %%%%%%%%%%%%%%%%%%%%
>>
>> \layout {
>> \context {
>> \Score
>> \consists #direction-to-arpeggio-direction-engraver
>> }
>> }
>>
>> \relative c'' {
>> <g b d g>4\arpeggio
>> <g b d g>4^\arpeggio
>> <g b d g>4_\arpeggio
>> }
>
> Here an improved version, works cross-context as well:
>
> \version "2.19.15"
>
> \paper { indent = 0 }
>
> direction-to-arpeggio-direction-engraver =
> #(lambda (context)
> (let ((dir '()))
> `((listeners
> (arpeggio-event
> .
> ,(lambda (engraver event)
> ;; Not sure about following 'set!'
> ;; Is it save?
> (set! dir (ly:event-property event 'direction))
> ;; Is this needed?
> ;(ly:event-set-property! event 'direction '())
> )))
> (acknowledgers
> (arpeggio-interface
> .
> ,(lambda (engraver grob source-engraver)
> (set! (ly:grob-property grob 'arpeggio-direction) dir)))))))
>
> %%%%%%%%%%%%%%%%%%%%
> %% EXAMPLES
> %%%%%%%%%%%%%%%%%%%%
>
> \new Staff \with { \consists #direction-to-arpeggio-direction-engraver }
> \relative c'' {
> <g b d g>4\arpeggio
> <g b d g>4^\arpeggio
> <g b d g>4_\arpeggio
> }
>
> %% Note:
> %% If used cross-context, only the last direction-indicator
> %% for each time-step counts
> \new Staff
> \with {
> \consists "Span_arpeggio_engraver"
> \consists #direction-to-arpeggio-direction-engraver
> }
> \relative c' {
> \set Staff.connectArpeggios = ##t
> <<
> \new Voice { \voiceOne <e' g>4\arpeggio <d f> <d f>2\arpeggio }
> \new Voice { \voiceTwo <d, f>2^\arpeggio <g b>2_\arpeggio }
> >>
> }
>
> \new PianoStaff
> \with {
> \consists #direction-to-arpeggio-direction-engraver
> }
> <<
> \set PianoStaff.connectArpeggios = ##t
> \new Staff {
> \relative c' {
> \key b \major
> \time 6/8
> b8-.(^\arpeggio fis'-.\> cis-. e-. gis-. b-.)\!\fermata^\laissezVibrer
> \bar "||"
> }
> }
> \new Staff {
> \relative c' {
> \clef bass
> \key b \major
> <<
> {
> <a e cis>2\arpeggio
> }
> \\
> {
> <a, e a,>2.^\arpeggio
> }
> >>
> }
> }
> >>
Delete the following. It's some syntax-testing, copied by accident
> \score {
> \relative c'' {
> \markLengthOn
>
> <>^"default"
> <g b d g>4\arpeggio
>
> <>^"^ indicator"
> <g b d g>4^\arpeggio
>
> <>^"direction-tweak"
> <g b d g>4-\tweak #'direction #RIGHT \arpeggio
>
> <>^"direction-override"
> \once \override Arpeggio.direction = #RIGHT
> <g b d g>4\arpeggio
> }
> \layout {
> ragged-right = ##f
> }
> }
>
>
> Cheers,
> Harm
- Re: arpeggioArrowUp, (continued)
- Re: arpeggioArrowUp, Phil Holmes, 2015/01/14
- Re: arpeggioArrowUp, Alistair Millar, 2015/01/14
- Re: arpeggioArrowUp, tisimst, 2015/01/14
- Re: arpeggioArrowUp, Noeck, 2015/01/14
- Re: arpeggioArrowUp, Thomas Morley, 2015/01/14
- Re: arpeggioArrowUp, Pierre Perol-Schneider, 2015/01/15
- Re: arpeggioArrowUp, tisimst, 2015/01/15
- Re: arpeggioArrowUp, Thomas Morley, 2015/01/15
- Re: arpeggioArrowUp, Thomas Morley, 2015/01/15
- Re: arpeggioArrowUp, Thomas Morley, 2015/01/16
- Re: arpeggioArrowUp,
Thomas Morley <=
- Re: arpeggioArrowUp, Pierre Perol-Schneider, 2015/01/17
- Re: arpeggioArrowUp, Noeck, 2015/01/29
- Re: arpeggioArrowUp, tisimst, 2015/01/29
- Re: arpeggioArrowUp, Noeck, 2015/01/29
- Re: arpeggioArrowUp, Thomas Morley, 2015/01/29
- Re: arpeggioArrowUp, Hwaen Ch'uqi, 2015/01/14
- Re: arpeggioArrowUp, Alistair Millar, 2015/01/14