Displaying chord symbols in music21 with LilyPond?

62 Views Asked by At

I'm trying to generate a lead sheet using music21 in Google Colab and lilypond. I have a stream with note objects and chord symbol objects, expecting the chord symbols to be represented as symbols above the notes in the score like a lead sheet, but when I call show('lily.png') on the stream, it realizes the notes of the chord symbol as actual notes, like the following:

stream with chords represented as notes

I'm entering the chord symbols in the stream with the following:

  for chordDur in chords:
    sym = harmony.ChordSymbol(chordDur[0])
    sym.quarterLength = chordDur[1]/4.0
    sym = sym.transpose('P8')
    phrase.insert(currOffset,sym)
    currOffset += chordDur[1]/4.0

Where chords is a list of tuples in the form of [chord names, duration in 16th notes], as in ['C', 16'] and 'phrase' is a preexisting stream of notes (the melody in this case). Is this possible / how can this be done?

0

There are 0 best solutions below