Smooth Voice Leading in Music21

97 Views Asked by At

With music21 I have generated a progression (stream) from baisc roman numerals:

numeral = ['i', 'vi', 'I', '#iii', '#iii', 'V', 'i', 'vii', 'I', 'I', 'vi', 'vii']
stream1 = stream.Stream()
for chrd in numeral:
    stream1.append(roman.RomanNumeral(chrd, key.Key('C')))
stream1.show()

Generated Progression: Generated Progression

With the current implementation, these are however always in root position.

Goal: Invert the chords so that the closest path, compared to the previous chord, is taken. In other words, minimize the distance between the voices.

In the example above the second chord should be in first inversion and then transposed down an octave.

Desired output: Desired output

I tried summing the MIDI note numbers of each note in the chord and comparing that with the sum of the previous chord, this resulted in some very messy code however (and didn't work)

0

There are 0 best solutions below