Use Turbo Mode for a better experience. Warning: Pretty Broken, mainly the conversion script though, but partially the scratch script. midi to txt py script in credits
from mido import MidiFile filename = input("Enter the path to your MIDI file (with quotes): ").strip('"') midi = MidiFile(filename) channel_instruments = {ch: 0 for ch in range(16)} for msg in midi: if msg.type == 'program_change': channel_instruments[msg.channel] = msg.program notes = [] delays = [] instruments = [] current_time = 0.0 last_time = 0.0 pending_time = None chord_notes = [] chord_channels = [] midi = MidiFile(filename) time_threshold = 0.02 # seconds – how close notes must be to be considered a chord for msg in midi: current_time += msg.time if msg.type == 'note_on' and msg.velocity > 0: # If the note is too far from the last, finalize the current chord if pending_time is not None and (current_time - pending_time) > time_threshold and chord_notes: delay = pending_time - last_time last_time = pending_time note_str = "~".join(str(n) for n in chord_notes) inst_str = "~".join( str(-1 if ch == 9 else channel_instruments.get(ch, 0)) for ch in chord_channels ) notes.append(note_str) instruments.append(inst_str) delays.append(delay) chord_notes = [] chord_channels = [] chord_notes.append(msg.note) chord_channels.append(msg.channel) pending_time = current_time if chord_notes: delay = current_time - last_time note_str = "~".join(str(n) for n in chord_notes) inst_str = "~".join( str(-1 if ch == 9 else channel_instruments.get(ch, 0)) for ch in chord_channels ) notes.append(note_str) instruments.append(inst_str) delays.append(delay) with open("notes.txt", "w", newline="\n") as f: for n in notes: f.write(n + "\n") with open("instruments.txt", "w", newline="\n") as f: for i in instruments: f.write(i + "\n") with open("delays.txt", "w", newline="\n") as f: for d in delays: f.write(f"{d:.4f}\n") print("✅ Conversion complete! Exported notes.txt, instruments.txt, and delays.txt.")