Hi! <3

Often when I write I find it easier to focus on pitches separately from
rhythms, especially in arrangements where lots of instruments are moving
rhythmically together but with their own separate pitches. I guess I could
write them as big chords and then... separate a voice out per instrument?

My current approach consists of writing the rhythms in its own variable,
which I then "apply" to the different collections of pitches to generate
the final voices. But I would be very curious to know what approaches you
all have, is anyone here thinking / writing in a similar way?

Here is a small example:

\version "2.26.0"

% Helper function to copy duration + articulations from one NoteEvent to
another NoteEvent
ApplyRhythmSingleEvent = #(define-music-function
  (Rhythm Note)
  (ly:music? ly:music? )
        (set!
          (ly:music-property Note   'duration)
          (ly:music-property Rhythm 'duration)
        )
        (set!
          (ly:music-property Note   'articulations)
          (ly:music-property Rhythm 'articulations)
        )
        Note
    )

% Helper function to copy duration + articulations from one phrase onto
another
ApplyRhythm = #(define-music-function
  (Rhythm Note)
  (ly:music? ly:music?)
  (make-music 'SequentialMusic 'elements
    (map ApplyRhythmSingleEvent
      (ly:music-property Rhythm 'elements)
      (ly:music-property Note   'elements)
    )
  )
)

% Voices are specified "free from rhythm"
Melody   = { e  f g c' b   d' dis' e' }
VoiceOne = { c  c c e f   b cis c }
VoiceTwo = { g' d e g g   a fis g }


% ...and rhythms are then applied to each voice
RhythmOne   = { 8.\f 16 4. 8 4 8 4. 2 }
RhythmTwo   = { 4\pp 4 4 4\mp 8\ppp 8 4 2 }
\score {
  <<
    \fixed c' {
      \ApplyRhythm \RhythmOne \Melody
      \ApplyRhythm \RhythmTwo \Melody
    }
    \relative c' {
      \ApplyRhythm \RhythmOne \VoiceOne
      \ApplyRhythm \RhythmTwo \VoiceOne
    }
    \relative c' {
      \ApplyRhythm \RhythmOne \VoiceTwo
      \ApplyRhythm \RhythmTwo \VoiceTwo
    }
  >>
  \layout {}
  \midi {}
}

I came to Lilypond with maybe a ... programmer's mindset. Maybe I'm greatly
confused, because I have seen people saying that Lilypond is mainly an
engraver and not a composition tool. But the presence of functions like
\retrograde seem to counter that.

Sometimes the "why" can get lost when trying to make up an example, so here
is a link to is how I used that in actual music
<https://www.hacklily.org/?iss=https%3A%2F%2Fgithub.com%2Flogin%2Foauth&edit=skogshjort%2Fsheet-music%2FSjung_du_min_dal.ly>
(nothing spectacular, just from writing down some stuff from my choir that
mainly teaches by ear)

Hope to hear from you!
/Nova

Reply via email to