genuinequality

Download free music MP3s on genuine quality, the world’s largest online music catalogue, powered by your scrobbles. Free listening, videos, photos, The world’s largest online music catalogue, powered by your scrobbles. Free listening, videos, photos, stats, charts, biographies and concerts. stats, charts, biographies and concerts.

Saturday, December 14, 2024

Counting the Notes in a MIDI File

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…
Read on blog or Reader
Site logo image Simple DIY Electronic Music Projects Read on blog or Reader

Counting the Notes in a MIDI File

By Kevin on December 14, 2024

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

Comment
Like
You can also reply to this email to leave a comment.

Simple DIY Electronic Music Projects © 2024.
Manage your email settings or unsubscribe.

WordPress.com and Jetpack Logos

Get the Jetpack app

Subscribe, bookmark, and get real‑time notifications - all from one app!

Download Jetpack on Google Play Download Jetpack from the App Store
WordPress.com Logo and Wordmark title=

Automattic, Inc.
60 29th St. #343, San Francisco, CA 94110

Posted by BigPalaceNews at 7:22 AM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Search This Blog

About Me

BigPalaceNews
View my complete profile

Blog Archive

  • October (82)
  • September (112)
  • August (116)
  • July (96)
  • June (100)
  • May (105)
  • April (95)
  • March (131)
  • February (111)
  • January (104)
  • December (98)
  • November (87)
  • October (126)
  • September (104)
  • August (97)
  • July (112)
  • June (113)
  • May (132)
  • April (162)
  • March (150)
  • February (342)
  • January (232)
  • December (260)
  • November (149)
  • October (179)
  • September (371)
  • August (379)
  • July (360)
  • June (385)
  • May (391)
  • April (395)
  • March (419)
  • February (356)
  • January (437)
  • December (438)
  • November (400)
  • October (472)
  • September (460)
  • August (461)
  • July (469)
  • June (451)
  • May (464)
  • April (506)
  • March (483)
  • February (420)
  • January (258)
  • December (197)
  • November (145)
  • October (117)
  • September (150)
  • August (132)
  • July (133)
  • June (117)
  • May (190)
  • January (48)
Powered by Blogger.