> And let's say I want to add fingering instructions, but only to the
> first <c e> <d f>, as if I had written
>
> \relative c' { <c-1 e-3>8 <d-2 f-4>8 <c e>8 <d f>8 <c e>8 <d f>8 <c e>8
> <d f>8 }
>
Sorry to answer so late.
This snippet can perhaps make your life easier :
http://lsr.di.unimi.it/LSR/Item?id=768
But it will not work as you expect if you use \repeat. I often use a function
like that, instead :
%------------------
nCopy = #(define-music-function (parser location n music)(integer? ly:music?)
(cond
((> n 1)(make-sequential-music
(map (lambda (x)(ly:music-deep-copy music))
(make-list n))))
((= n 1) music)
(else (make-music 'Music 'void #t))))
%-----------------
So the full code for you would be :
%------------------------------------------
\version "2.18.2"
\include "fingering.ly"
%% get this file at :
%% http://gillesth.free.fr/Lilypond/fingering/fingering.ly
%% doc and tests here :
%% http://gillesth.free.fr/Lilypond/fingering/
nCopy = #(define-music-function (parser location n music)(integer? ly:music?)
(cond
((> n 1)(make-sequential-music
(map (lambda (x)(ly:music-deep-copy music))
(make-list n))))
((= n 1) music)
(else (make-music 'Music 'void #t))))
music = \nCopy #4 \relative c' { <c e>8 <d f>8 }
\addFingering \music
#"1324"
% RESULT =>
% { <c-1 e-3>8 <d-2 f-4>8
% <c e>8 <d f>8
% <c e>8 <d f>8
% <c e>8 <d f>8 }
%----------------------------------
DRAWBACKS : You have to use \relative *after* \nCopy :
Something like
\relative c' {
...
\nCopy #4 { c' d}
...
}
will give you some strange results...
You may want either to work in \absolute mode or to replace in the code of
\nCopy, the string :
(ly:music-deep-copy music)
by :
(ly:music-deep-copy #{ \relative c' \music #})
--
Gilles
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user