To accompany the replaying of my The Complete Lo-Fi Planets this week on Mastodon, I thought it would be interesting to work out how many notes I had to arrange when building the MIDI files in MuseScore3 from the original orchestral full score.
This can be done with a relatively simple python script, using the mido module for "MIDI objects" - see https://mido.readthedocs.io/en/stable/index.html - I just have to iterate through each track in each MIDI file, counting the NoteOn events.
Here is the script:
import mido
def countMidiFileNotes (filename):
mid = mido.MidiFile(filename)
notecount = 0
for i, track in enumerate(mid.tracks):
for msg in track:
if msg.type == 'note_on':
notecount+=1
return notecount
mars = countMidiFileNotes("mars.mid")
venus = countMidiFileNotes("venus.mid")
mercury = countMidiFileNotes("mercury.mid")
jupiter = countMidiFileNotes("jupiter.mid")
saturn = countMidiFileNotes("saturn.mid")
uranus = countMidiFileNotes("uranus.mid")
neptune = countMidiFileNotes("neptune.mid")
print("Mars: Note count=", mars)
print("Venus: Note count=", venus)
print("Mercury: Note count=", mercury)
print("Jupiter: Note count=", jupiter)
print("Saturn: Note count=", saturn)
print("Uranus: Note count=", uranus)
print("Neptune: Note count=", neptune)
print("Total Note Count=", mars+venus+mercury+jupiter+saturn+uranus+neptune)
This assumes that the MIDI files are in the same directory as the script and named accordingly of course.
If anyone is interested, here are the results:
Mars: Note count= 12315
Venus: Note count= 2965
Mercury: Note count= 6210
Jupiter: Note count= 15238
Saturn: Note count= 5991
Uranus: Note count= 7850
Neptune: Note count= 4860
Total Note Count= 55429
So now we know 🙂
Kevin
No comments:
Post a Comment