[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Tweaking in scheme
From: |
Peter Gentry |
Subject: |
RE: Tweaking in scheme |
Date: |
Mon, 29 Jun 2015 12:25:04 +0100 |
>-----Original Message-----
>From: Thomas Morley [mailto:address@hidden
>Sent: Monday, June 29, 2015 12:10 PM
>To: Peter Gentry
>Cc: lilypond-user
>Subject: Re: Tweaking in scheme
>
>2015-06-29 12:54 GMT+02:00 Peter Gentry <address@hidden>:
>>
>> Tweaking in scheme
>>
>> The heart of the scheme procedure I'm trying is
>>
>> #(define (instrumentrange music instrument )
>> ( ly:music? string? )
>> ; extract the various portions of the music object (let ((es
>> (ly:music-property music 'elements))
>> (e (ly:music-property music 'element))
>> (p (ly:music-property music 'pitch)));rebuild
>the pitch and if a changed pitch add the color tweak
>> ...
>> ...
>>
>> (if (ly:pitch? p)
>> (let ((new-pitch (naturalize-instrument-range p
>instrument)))
>> (ly:music-set-property! music 'pitch new-pitch)
>> (if (and (not (equal? p new-pitch)) (color? my-color))
>> (ly:music-set-property! music 'tweaks
>> (acons
>> 'color my-color
>> (ly:music-property music 'tweaks))))))
>>
>> music))
>>
>> This works fine and I have used \displayMusic to show the
>music stream
>> to investigate other possible properties that can be
>specified in this way.
>>
>> I would like to specify note head style but this does not
>seem to appear as a property that can be applied in the acons list.
>> In display music there is a complex list
>
>This is an \override
>
>> (make-music
>> 'ContextSpeccedMusic
>> 'contextt-type
>> 'Bottom
>> 'element
>> (make-music
>> 'OverrideProperty
>> 'pop-first
>> #t
>> 'grob-property-path
>> (list (quote style))
>> 'grob-value
>> 'harmonic
>> 'symbol
>> 'NoteHead))
>>
>> Can this in any way be implimented by the 'tweaks method.
>
>
>
>How about:
>
>\version "2.19.21"
>
>%% regard output of:
>\displayMusic
>{ \tweak style #'harmonic a'1 }
>
>tweakI =
>#(define-music-function (parser location music)(ly:music?)
> (ly:music-set-property! music 'tweaks
> (acons 'style 'harmonic
> (acons 'color red
> (ly:music-property music 'tweaks))))
> music)
>
>{ \tweakI a'1 }
>
>%% or:
>
>tweakII =
>#(define-music-function (parser location music)(ly:music?)
> #{
> \tweak color #red
> \tweak style #'harmonic
> $music
> #})
>
>{ \tweakII a'1 }
>
>
>HTH,
> Harm
Thankyou very musch that works a treat.
I couldn't find any specific information in the manuals and the displayMusic
output contains a lot more than simply 'style and
'harmonic.
- Tweaking in scheme, Peter Gentry, 2015/06/29
- Re: Tweaking in scheme, Urs Liska, 2015/06/29
- Re: Tweaking in scheme, Trevor Daniels, 2015/06/29
- Re: Tweaking in scheme, Kieren MacMillan, 2015/06/29
- Re: Tweaking in scheme, Paul Morris, 2015/06/29