Skip to main content

Python MIDI Visualiser 🎹

PyPI Version

A real-time MIDI player and visualiser built with Python and Pygame.

This tool can be run from the command line to open any .mid file as a dynamic, scrolling piano roll, synchronising the on-screen notes with the audio output.

MIDI Visualiser Demonstration GIF

Key Features

  • 🎵 MIDI File Parsing: Uses the Mido library to load and interpret note events and channels from MIDI files
  • 🎹 Real-time Piano Roll: Dynamically renders scrolling notes as the music plays
  • 🔊 Synchronised Audio: Plays the MIDI data through Pygame's audio mixer, synchronised with the visuals
  • ⏯️ Playback Control: Includes standard playback features like play, pause, and restart, controlled via keyboard shortcuts
  • 🎨 Multi-channel Colouring: Automatically assigns different, clear colours to notes from different MIDI channels

Installation and Usage

To use the tool, you can simply install it using pip:

pip install midi-visualiser

It can then be used in the command line through the midi-visualiser command. The command has two different modes:

  1. Visualising a single song:

    midi-visualiser path/to/your/song.mid
    
  2. Loading a playlist from a directory:

    midi-visualiser path/to/your/songs/folder/
    

    When a path to a directory is provided, all .mid files in the directory will be loaded and can then be switched between using the left and right arrow keys.

Example Songs

The project is packaged with 10 example songs, which will be automatically loaded when the midi-visualiser command is run without specifying any arguments.

Playback Controls

The following keyboard shortcuts are available while the visualiser window is active:

Key Action
Space Play / Pause the current song.
R Reset the current song to the beginning.
← / → Cycle to the previous/next song in the current playlist.
Q Close the application window.

Development Setup

This project uses uv as a package and virtual environment manager. To set up the project for development, follow these steps:

  1. Clone the repository:

    git clone https://github.com/benjaminrall/midi-visualiser.git
    cd midi-visualiser
    
  2. Run the application using uv:

    uv run midi-visualiser
    

    This will automatically install any required packages and run the command in a virtual environment, including any changes to the source code.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for midi-visualiser 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for midi-visualiser 0.1.10
File Size Uploaded Provenance Actions
midi_visualiser-0.1.10.tar.gz 225.6 kB Without provenance Details for midi_visualiser-0.1.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for midi-visualiser 0.1.10
File Interpreter ABI Platform Actions
midi_visualiser-0.1.10-py3-none-any.whl Python 3 none any Details for midi_visualiser-0.1.10-py3-none-any.whl

Total release size: 451.0 kB

Release files / midi_visualiser-0.1.10.tar.gz

Download URL midi_visualiser-0.1.10.tar.gz
Size 225.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f112caf0a9811c858a0a74f18d755d02ee808ae5c3f011f24b88606809d21ce0
BLAKE2b-256 checksum
How to use checksums
5b478d83fc8dc0e6b4995cb3067f94e4a9584185ad4020332a1e5fb335ffaa9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.19

Release files / midi_visualiser-0.1.10-py3-none-any.whl

Download URL midi_visualiser-0.1.10-py3-none-any.whl
Size 225.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f47938966c79f22a103b647f422a8c3b4bddb54851e75122f2561271b6940f7
BLAKE2b-256 checksum
How to use checksums
28a74e1967b9e59657d415d1c564fae2c019b1bb47fee2548df1c90f5339c928
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.19

Security for midi-visualiser 0.1.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page