lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to write a scheme function to override glissando properties


From: Patrick Schmidt
Subject: Re: how to write a scheme function to override glissando properties
Date: Sun, 19 Dec 2010 22:29:17 +0100


Am 19.12.2010 um 21:26 schrieb jakob lund:

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

Hi Jakob,

thank you, too for your solution. I did have a look at the section on adding articulation to notes in Extending but I think I have a different problem. I actually wanted to write a function that calls \glissando and overrides its properties more or less for the whole score. I'd even prefer to tweak the command \glissando in order to get the same output in a Staff and a TabStaff. But I probably didn't look in the right place. I just found the definition of \glissando in property-init.ly:

glissando = #(make-music 'GlissandoEvent)

But I didn't manage to override its properties. Maybe you know how to do it?

Thanks,

patrick
_______________________________________________
lilypond-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user




reply via email to

[Prev in Thread] Current Thread [Next in Thread]