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.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.4.tar.gz (5.4 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.4-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: midi-player-0.4.tar.gz
  • Upload date:
  • Size: 5.4 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.4.tar.gz
Algorithm Hash digest
SHA256 f700fcf68c5b568651dfceb155085594654584918a1f994f6e7d576d3a8270b9
MD5 f88b56b926cd5d1fbdbf405bbddcab7a
BLAKE2b-256 e51d96536e1b4605fa1b3ac0f60fef093e50608ac4183bb3e5bbc1e222fa328e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: midi_player-0.4-py3-none-any.whl
  • Upload date:
  • Size: 6.0 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2021daf3e6aa683ab49353db5eddbe1df199ff12aca9c848a0e575296572330e
MD5 5e23a08662b1445794b369ab4c5f3190
BLAKE2b-256 32010e949a91263b73a1865131cffd2ad89c6e9c86d3edc12ffbebe6e31f9f5f

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