lilypond-user
[Top][All Lists]
Advanced

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

Re: Stack Trace on Error? Now with the right files!


From: Thomas Morley
Subject: Re: Stack Trace on Error? Now with the right files!
Date: Sat, 31 Jan 2015 00:43:02 +0100

2015-01-29 22:06 GMT+01:00 address@hidden <address@hidden>:
> On 2015-01-28 21:45, Pierre Perol-Schneider wrote:
>>
>> Thank you Anders,
>>
>>
>> myNotes = \relative c' { \pedA a2\5 \pedF cis'2\4 } seems to work.
>>
>>
>> It seems that your function cannot be applied into a chord.
>>
>
> Well, I don't know what to say...
>
> Ok, now I understand the error message:  not a
>     rhythmic event
>
> I might live with myNotes = \relative c' << \pedA a2\5 \pedF cis'2\4 >> ,
> which also seem to work.

Applying your unchanged function returns:

GNU LilyPond 2.19.15
Processing `firsttest.ly'
Parsing...
Interpreting music...
warning: Requested string for pitch requires negative fret: string 5
pitch #<Pitch g >
warning: Ignoring string request and recalculating.
warning: Requested string for pitch requires negative fret: string 4
pitch #<Pitch bis >
warning: Ignoring string request and recalculating.

I wouldn't call it "seem to work" ;)


>
> But, just so that I understand. Is it possible to write a music-function
> that can e.g. do a transpose on one of the notes in a chord?
> Maybe you can destructure the chord into notes and do the work and then make
> a chord again...?

You could try:

\version "2.19.15"

tranpose-last-chord-entry =
#(define-music-function (parser location p ev-chrd)(ly:pitch? ly:music?)
;; takes an EventChord and returns a new EventChord with last of the original
;; entry transposed by @var{p}
(if
    ;; select event-chords only
    (music-is-of-type? ev-chrd 'event-chord)
    (let* (;; get the notes from event-chord
           (notes (event-chord-notes ev-chrd))
           ;; transpose the last
           (last-transposed
             #{
               \transpose c $p #(last notes)
             #})
           ;; get the transposed note from 'TransposedMusic
           (last-transposed-note
             (ly:music-property last-transposed 'element)))
      ;; make a new event-chord containing all but the last entry
      ;; of the original and the transposed last entry
      (make-event-chord
        (append
          (drop-right notes 1)
          (list last-transposed-note))))

    ;; if 'ev-chord' is not an EventChord simplay return it unchanged
    ev-chrd))

\relative c' {
  \tranpose-last-chord-entry des
  <f a c>
}


Sorry not being able to do more, I've no clue how the desired output
should look finally...

Cheers,
  Harm



reply via email to

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