2015-01-29 22:06 GMT+01:00 [email protected] <[email protected]>:
> 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
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user