lilypond-user
[Top][All Lists]
Advanced

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

Re: trying to create a function with different pitches and different rhy


From: Aaron Hill
Subject: Re: trying to create a function with different pitches and different rhythms
Date: Sat, 23 Jun 2018 02:38:18 -0700
User-agent: Roundcube Webmail/1.3.6

On 2018-06-23 01:14, Stefan Thomas wrote:
Dear community,
I want to create a function, which adds automatically a crescendo from ppp
to pp to two tied pitches with different durations.
What  I dont understand:
I can create a function with the same pitch and different durations, I can
also create a function with diferent pitches and same durations, but if
both are choosen freely, I can't do it. Can someon give me a hint, whats
wrong with the code?

\version "2.18.2"

\layout { \context { \Voice \override Hairpin.minimum-length = #10 } }

%different durations, different  pitches, this doesn't work, why?
fadeIn = #(define-music-function (parser location PITCH durA durB)
(ly:pitch?  ly:duration? ly:duration?)
             #{
                 $PITCH  $durA  \<\ppp ~  $PITCH $durB \pp
               #})
\new Staff { \fadeIn c' 4 2. }

For reference, this works just fine against 2.19.81. However, on 2.18.2 it errors:

input.ly:11:22: error: wrong type for argument 1. Expecting pitch, found (make-music (quote NoteEvent) (quote duration) (ly:make-duration 2 0 1) (quote pitch) (ly:make-pitch 0 0 0))
\new Staff { \fadeIn
                     c' 4 2. }

Looks like 2.18.2 is trying to read `c' 4` as a single argument. Consider the following:

%%%%
fadeIn = #(define-music-function (parser location PITCH DUMMY durA durB)
    (ly:pitch? string? ly:duration? ly:duration?)
    #{ $PITCH $durA \<\ppp ~ $PITCH $durB \pp #})
  \new Staff { \fadeIn c' "" 4 2. }
%%%%

Forcing a dummy argument between the pitch and duration seems to allow 2.18.2 to parse this.

-- Aaron Hill



reply via email to

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