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)

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.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.3.tar.gz (4.8 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.3-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for midi-player-0.3.tar.gz
Algorithm Hash digest
SHA256 12c50d611a33ee47f871859db6ad19db42f7cdccbf6011f52be518c90d604813
MD5 6d120edeb3f05c7c1f36273e26b2251f
BLAKE2b-256 2c9115946116121b63f0ae21ddc84da466a2e821d2c1d7900525b04850771ff2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for midi_player-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 38515b7a2b1f829f877af8934d742fc95230c0c60889a5d444b35b883c573b4b
MD5 dc031c9e54be8da55a584965a740b466
BLAKE2b-256 a6ef36c7eb857cb890405d12048e1579249e75a8480fb47cd3b910afb7d42970

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