Skip to content

Instantly share code, notes, and snippets.

@queercat
Created June 2, 2026 06:43
Show Gist options
  • Select an option

  • Save queercat/e66c76c73d551c04103ac856b35170c9 to your computer and use it in GitHub Desktop.

Select an option

Save queercat/e66c76c73d551c04103ac856b35170c9 to your computer and use it in GitHub Desktop.
ableton midi to time sequence
import mido
import typer
def main(relative_path: str, target_bpm: int):
midi = mido.MidiFile(relative_path)
current_tick = 0
ratio = 60 / target_bpm
for message in midi:
current_tick += message.time * 96 * 2
if message.type == "note_on":
print((current_tick / 96) * (ratio))
if __name__ == "__main__":
typer.run(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment