lilypond-user
[Top][All Lists]
Advanced

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

Re: Glissando tweaks in chords


From: Thomas Morley
Subject: Re: Glissando tweaks in chords
Date: Sat, 8 Dec 2018 11:37:05 +0100

Am Fr., 7. Dez. 2018 um 06:08 Uhr schrieb Peter Crighton
<address@hidden>:
>
> On Fri, 7 Dec 2018 at 03:00, Ben <address@hidden> wrote:
>>
>> On 12/6/2018 7:49 PM, Peter Crighton wrote:
>>
>> Hello all,
>>
>> I have the following (reduced) scenario where one voice has a chord with a 
>> glissando in it and I want to tweak both glissandos differently. Is it 
>> possible? The second (currently commented out) tweak is never applied even 
>> if I comment out the first tweak.
>>
>> \version "2.19.82"
>> one = \relative c'' {
>>   g2
>>   -\tweak Y-offset #0.25
>>   \glissando a
>> }
>> two = \relative c'' {
>>   \context Voice = "one" {
>>     c2
>>     % this tweak is never applied
>>     % -\tweak Y-offset #-0.25
>>     \glissando d
>>   }
>> }
>> \new Staff <<
>>   \new Voice = "one" \one
>>   \two
>> >>
>>
>> Thanks,
>> Peter
>>
>> A while ago, there was a function created that allowed tweaks like you're 
>> asking - I think this is what you are looking for :) It should get you 
>> started.
>>
>> http://lilypond.1069038.n5.nabble.com/How-to-tweak-override-the-individual-Glissando-objects-in-a-chord-td149575.html

This is one of my older codings. As far as adding text to glissandi is
concerned, I use a better coding nowadays, I'll probably out it in LSR
>
>
> Thanks, that helped a lot! I boiled it down to:
>
> \version "2.19.82"
> glissTweak =
>   #(define-music-function (parser location lst)(pair?)
>     #{
>       \once \override Glissando #'after-line-breaking =
>         #(lambda (grob)
>           (let ((gliss-count (ly:grob-property grob 'glissando-index)))
>             (map (lambda (x)
>               (let ((gliss-nmbr (car x))
>                     (property-value-alist (cdr x)))
>                 (if (eq? gliss-nmbr gliss-count)
>                   (map
>                     (lambda (y) (ly:grob-set-property! grob (car y) (cdr y)))
>                     property-value-alist)
>                   #f)))
>               lst)))
You may replace the following line:
>       $(make-music 'EventChord 'elements (list (make-music 'GlissandoEvent)))
with
      <>\glissando
or delete it and put \glissando in \one below. Both works.
>     #})
>
> one = \relative c'' {
>   \glissTweak #`((0 . ((Y-offset . 0.25)))
>                  (1 . ((Y-offset . -0.25))))
>   g2 a
> }
> two = \relative c'' {
>   \context Voice = "one" {
>     c2 d
>   }
> }
> \new Staff <<
>   \new Voice = "one" \one
>   \two
> >>
>
> This is lovely and very flexible and does what I need it to do (and more).
> But I would also be interested in a more minimal version because I usually 
> only care about Y-offsets. Preferably something that wouldn’t remove the 
> \glissandos from the syntax, so I could have something like
>
> \once \override Glissando.Y-offset =
>     #(lambda (grob) (and
>       (if (= 0 (ly:grob-property grob 'glissando-index)) '0.25)
>       (if (= 1 (ly:grob-property grob 'glissando-index)) '-0.25)))
> <g c>2\glissando <a d>
>
> if only that would work. It probably won’t be as easy as that. But my Scheme 
> is very modest, and I don’t even know where to begin with something like 
> that. Any ideas?

It doesn't work because the return value is unspecified, if
glissando-index is zero. Try:

{
  \once \override Glissando.Y-offset =
    #(lambda (grob)
      (cond
        ((= 0 (ly:grob-property grob 'glissando-index)) 1.25)
        ((= 1 (ly:grob-property grob 'glissando-index)) -1.25)
        ))
  <g c>2\glissando <a d>
}
Ofcourse there is no coding yet, if glissando-index is greater than 1.
Btw, there's no need to prepend numbers in guile with a '-sign


Cheers,
  Harm



reply via email to

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