2017-01-30 19:16 GMT+01:00 Mojca Miklavec <mojca.miklavec.li...@gmail.com>: > Hi, > > I can easily use a macro to create chords of predefined lengths, say > > chord_F = { <f a c'>4 } > > but the functionality is limited for what I want to achieve. > > On some instruments (like accordion) one gets that chord by pressing a > single button and I need some reasonable way to enter them without > messing everything up. > > (Some songs consist of only two different chords and I find it tedious > to keep entering <f a c'> <e g c'> over and over again, making lots of > mistakes, if I could assign that to just "F" and "C" or numbers 4 and > 2. \somelongwordF and \somelongwordC are still better than writing out > the full chord; the compiler would catch it if I make a spelling > mistake.) > > What I would like to be able to do is: > > - specify lengths > \chord_F4 \chord_F2 or <\chord_F>4 <\chord_F>2 > > - combine chords with other pitches (in theory perhaps with other > chords as well, but I never needed that so far) > <f, \chord_F>8 > > > To get things like > > chord_F = { f a c' } > melody = { > f,8 <\chord_F>8 c8 <\chord_F>8 | > <f, \chord_F>2 > } > > What options do I have to achieve the desired functionality? (I don't > care about the exact syntax as long as it would allow me to achieve > consistency.) > > > Thank you very much, > Mojca > > (Please CC me.)
How about: \version "2.19.52" chord = #(define-music-function (mus dur)(ly:music? ly:duration?) (let ((evc-notes (extract-typed-music mus 'note-event))) (for-each (lambda (note-ev) (ly:music-set-property! note-ev 'duration dur)) evc-notes) (make-event-chord evc-notes))) chord_F = \chord <f a c'> \etc chord_Gm = \chord <g' bes' d''> \etc { \set Score.skipBars = ##t \chord_F16 \chord_F1 \chord_F32.. \chord_F\longa \chord_Gm128 \chord_Gm2 \chord_Gm4 << f''8 \\ \repeat unfold 3 \chord_F16*2/3 >> } %% remark: %% n.b.: \chord_F4 <-- a duration is needed, the value doesn't matter chord_XY = \chord { fis'' \chord_F1 } \etc { \chord_XY 64. \chord { gis'' \transpose f f' \chord_F4 ees } 32 } The following I don't understand. Not playing accordion, though > > PS: At some point in the future I would ideally like to be able to > prepare single input to get both of the following modes as output (but > that's already the next step): > > \new Staff = "staff" << > \new Voice = "bass" { > \clef bass > \repeat unfold 3 { f,8 <f a c'> c, <f a c'> | } % push mode > \repeat unfold 4 { g,8 <e g c'> c, <e g c'> | } % pull mode > <f, f a c'>2 | % push mode > } > >> > > \new FiguredBass { > \figuremode { > \repeat unfold 3 { <4>8 <3> <2> <3> | } % push mode > \repeat unfold 4 { <2>8 <3> <4> <3> | } % pull mode > <4 3>2 | % push mode > } > } Cheers, Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user