Skip to content

Instantly share code, notes, and snippets.

import mido
# Create a new MIDI file with one track
mid = mido.MidiFile()
track = mido.MidiTrack()
mid.tracks.append(track)
# Set the tempo (in microseconds per quarter note)
tempo = mido.bpm2tempo(120)
track.append(mido.MetaMessage('set_tempo', tempo=tempo))