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

jupyter_midi_player-0.6.0.tar.gz (146.5 kB view details)

Uploaded Source

Built Distribution

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

jupyter_midi_player-0.6.0-py3-none-any.whl (148.6 kB view details)

Uploaded Python 3

File details

Details for the file jupyter_midi_player-0.6.0.tar.gz.

File metadata

  • Download URL: jupyter_midi_player-0.6.0.tar.gz
  • Upload date:
  • Size: 146.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for jupyter_midi_player-0.6.0.tar.gz
Algorithm Hash digest
SHA256 c3b58f7db2967894018d5ab28b94a75051cd78e73c01b98929274494df74c135
MD5 09e7410a26a7e57932f2ac0485946927
BLAKE2b-256 42ba73a39a8f04d419638587a4c1b5f9016e9616fddd2dcb674007ffcaf28867

See more details on using hashes here.

File details

Details for the file jupyter_midi_player-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyter_midi_player-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05b12de3f0f56be395fc36c139046b2081875377a876a6df7e33ea4ee900deca
MD5 3d2ecc53be6ac2471bccaaa6eae96c2a
BLAKE2b-256 41f099ac39cbb6c5ddd3d3623706c3e9021cf5d15abdaed96482783ba70e91b1

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 Pingdom Monitoring Sentry Error logging StatusPage Status page