Skip to main content

Python launcher of animated MIDI player by @cifkao & @magenta

Project description

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.

Project details


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.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

midi_player-0.5.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: midi-player-0.5.1.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.1.tar.gz
Algorithm Hash digest
SHA256 a1f6f89ec83ee510a58986f584309175b18f1265e842ce48b33c4de0a5f520a0
MD5 5a04806792c35049af6c2275c21c0eeb
BLAKE2b-256 b1847f368f3d4ea0db2bd8798675dd3400eb6fd097a9b2d8197b32afa59ff2cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: midi_player-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0efad3801b57edf1176054bd9a8647aa5a7c1001ba65c2377080f365a51a7bb4
MD5 d4e854ad1db734e5a52ac0edfafdaabd
BLAKE2b-256 5685cdacc44b0227156dbcdc237b8ee89d87df2c92e70aa5b08a13fcb3220ee2

See more details on using hashes here.

Supported by

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