salu133445 / muspy

A toolkit for symbolic music generation
https://salu133445.github.io/muspy/
MIT License
435 stars 51 forks source link

muspy.read unable to retrieve key_signatures #56

Open raymondtoh94 opened 3 years ago

raymondtoh94 commented 3 years ago

Some Midi file unable to retrieve the mode and root of the key_signatures. This problem unable to allow us to transpose our tracks.

interval = song.key_signatures[0].root
    if song.key_signatures[0].mode == "major": #Convert to CMAJ
        if interval > 0:
            song.transpose(-interval)
            song.key_signatures[0].root = 0
    elif song.key_signatures[0].mode == "minor": #Convert to AMin
        if interval < 9:
            song.transpose(interval)
        elif interval > 9:
            song.transpose(-interval)
        song.key_signatures[0].root = 9