I have this code, as part of a project to read and interpret a MIDI file:
midi_data = m21.converter.parse(midi_file)
key = midi_data.analyze('key')
print(key.name)
I need to get the key information. With this code, the first key is shown, but it does not correspond to a modulation.
How can I detect modulations?