Skip to main content

midi-player

Python launcher of the html-midi-player by @cifkao & @magenta

Works with local and web-hosted MIDI files in Jupyter, Colab, WandB,...probably other contexts.

Installation

pip install midi-player

Usage

Only tested with Jupyter Notebooks & Colab, but uses no IPython dependencies so it should work in other contexts.

from midi_player import MIDIPlayer
from midi_player.stylers import basic, cifka_advanced

midi_file_url = "https://magenta.github.io/magenta-js/music/demos/melody.mid"
midi_file = "data/test_midi.mid"

MIDIPlayer(midi_file_url, 400)  
MIDIPlayer(midi_file, 160, styler=cifka_advanced, title='My Player')

With wandb:

import wandb

wandb.login()
wandb.init(project="midi-player")
mp = MIDIPlayer(midi_file, 300, viz_type="waterfall")
wandb.log({'player':wandb.Html(mp.html)})
wandb.finish()

See examples/ for more.

Documentation

TO-DO. Particularly, people will want to know how to add/customize their own "stylers". See midi_player/*.py for now ;-).

Known Issues / Release Notes

  • Not sure why the staff view is putting out 32nd notes / how to tell it to do 8th notes instead.
  • v0.5: Added title= kwarg, as workaround b/c Quarto mixes up ordering of print and IFrame elements
  • v0.4: Refactored stylers.py. Added a dark mode styler.
  • v0.3: Added an optional Download link! (Maybe you'll think it's ugly but it works.) Note: WandB disables usual opening-in-new tab browser behavior, so on WandB you'll need to Right-Click the download link and choose "Open in New Tab" to get the file.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

midi-player-0.5.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

midi_player-0.5-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file midi-player-0.5.tar.gz.

File metadata

  • Download URL: midi-player-0.5.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for midi-player-0.5.tar.gz
Algorithm Hash digest
SHA256 400204896cf680af5e5a7ab9eeeee79b5b779f7c8be87517d9343dbcdfc30bf4
MD5 07301930582b172c36dd7ab3c8298190
BLAKE2b-256 c842ffbd3f75b1e9f562f40851695a3b449caa51113049476d74d45202bd703f

See more details on using hashes here.

File details

Details for the file midi_player-0.5-py3-none-any.whl.

File metadata

  • Download URL: midi_player-0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for midi_player-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2a31f53e42880c32cd35765d24f4f5b69ad82fd02bfbdd88e2263010290af0d2
MD5 db4110740a54c471e1c7d8046698481d
BLAKE2b-256 49e051f9e81140280dc6bc46ba42f31e73b17c2b6267322f3453f00240affe8d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page