Skip to content

Instantly share code, notes, and snippets.

@Zizazar
Created February 1, 2025 18:41
Show Gist options
  • Select an option

  • Save Zizazar/06a6668514a8e40791bb84a86975e726 to your computer and use it in GitHub Desktop.

Select an option

Save Zizazar/06a6668514a8e40791bb84a86975e726 to your computer and use it in GitHub Desktop.
# Small script that converts one track of midi to Scrap Computers HDD array.
import mido
import json
mid = mido.MidiFile('bad_apple.mid')
converted = []
for msg in mid.tracks[0]:
if not msg.is_meta and msg.type in ('note_on', 'note_off'):
converted.append([1 if msg.type == 'note_on' else 0, msg.note, msg.velocity, msg.time])
with open("./bad_apple.json", "w") as f:
json.dump(converted, f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment