[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to write a scheme function to override glissando properties
From: |
jakob lund |
Subject: |
Re: how to write a scheme function to override glissando properties |
Date: |
Sun, 19 Dec 2010 21:26:33 +0100 |
I
2010/12/19 Marc Hohl <address@hidden>:
> Am 16.12.2010 17:04, schrieb Patrick Schmidt:
>>
>> [...]
>> Hi Marc,
>>
>> thanks for your solution but I'm still trying to find out what's wrong
>> with the scheme function I posted. I discussed the need for this function
>> with Carl and he gave me some advice:
>> http://www.mail-archive.com/address@hidden/msg32745.html.
>>
>> It might be impossible to find a general set of values for staves and tab
>> staves. If I don't succeed I learned something about writing scheme
>> functions, at least. Maybe you can spot the mistake in the function?
>
> Hm, I don't know what's wrong - I tried something like
>
> slide =
> #(define-music-function (parser location len thick beg end) (number? number?
> ly:music? ly:music?)
> #{
> \once \override Glissando #'minimum-length = $len
> \once \override Glissando #'thickness = $thick
> \once \override Glissando #'springs-and-rods =
> #ly:spanner::set-spacing-rods
> $beg \glissando $end
> #})
>
>
> myMusic = \relative c' {
> \slide #10 #5 a4 b4\3
> }
>
> \score {
> <<
> \new Staff {
> \new Voice {
> \clef "treble_8"
> \myMusic
> }
> }
> \new TabStaff {
> \new TabVoice {
> \myMusic
> }
> }
>>>
> }
>
> and that doesn't work either. I don't understand why ...
>
I think what happens is that the start note, passed to your function,
is already wrapped up in an object. \glissando is meant for use with a
single note, rather than with a music object.
You can use scheme to add the `start glissando' property to the object though:
\version "2.13.40"
slide = #(define-music-function (parser location length startnote)
(number? ly:music?)
#{
\once\override Voice.Glissando #'minimum-length = $length
\once\override Voice.Glissando #'springs-and-rods =
#ly:spanner::set-spacing-rods
#(begin
(set! (ly:music-property $startnote 'elements)
(cons (make-music (quote GlissandoEvent))
(ly:music-property $startnote 'elements)
))
(ly:export $startnote))
#})
{ \slide #7 a'' e'' }
this page contains a similar example
http://lilypond.org/doc/v2.13/Documentation/extending/adding-articulation-to-notes-_0028example_0029
Jakob