Created
April 21, 2026 15:14
-
-
Save ology/d5bf25d7636c2b953feabd0c57cc1c07 to your computer and use it in GitHub Desktop.
Working Python Clock Listener
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import mido | |
| # print("Available Inputs:", mido.get_input_names()) | |
| port_name = 'IAC Driver Bus 1' | |
| try: | |
| with mido.open_input(port_name) as inport: | |
| print(f"Listening for MIDI clock on '{port_name}'...") | |
| for msg in inport: | |
| if msg.type == 'clock': | |
| # This executes 24 times per beat | |
| print("Tick") | |
| elif msg.type == 'start': | |
| print("DAW Playback Started") | |
| elif msg.type == 'stop': | |
| print("DAW Playback Stopped") | |
| except KeyboardInterrupt: | |
| print("\nStopping...") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment