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.1: Lightened title text color in Dark Mode for better visibility on dark backgrounds
  • 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.2.tar.gz (7.2 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.2-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file midi_player-0.5.2.tar.gz.

File metadata

  • Download URL: midi_player-0.5.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.9

File hashes

Hashes for midi_player-0.5.2.tar.gz
Algorithm Hash digest
SHA256 3c0d554ff3fca76126b1659488ad04280a0d23e584e265d610d6f367715d4086
MD5 ccad087b389cf5fb4010bc06f9335505
BLAKE2b-256 dc932557cba1d2464b46b40c7666d1edb6be5beabb89da476575558425357dbe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: midi_player-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.9

File hashes

Hashes for midi_player-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5de960e415ac127a7fa25539c2c334e21648fdce3cce9a7b29aed070dfcea0e7
MD5 f5884af26902730662434862f5a66a9d
BLAKE2b-256 b58c5564e0439308dfb08bcef25386961f357cf0bfa0d4a0e6dcd6541fed3f58

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 files

0.5.1

2 files

0.5

2 files

0.4

2 files

0.3

2 files

0.2

2 files

0.1

2 files

Supported by

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