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: Marc Mouries
Subject: Re: how to write a scheme function to override glissando properties
Date: Thu, 23 Dec 2010 07:14:02 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7


This slide function is great. I always have to tweak the glissando command because it is always too small.



On 12/19/2010 3:26 PM, jakob lund wrote:
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

_______________________________________________
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]