# midi-player
Python launcher of the [`html-midi-player`](https://github.com/cifkao/html-midi-player) by [@cifkao](https://github.com/cifkao) & [@magenta](https://github.com/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.
```python
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`:
```python
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/drscotthawley/midi-player",
"name": "midi-player",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Scott H. Hawley",
"author_email": "scott.hawley@belmont.edu",
"download_url": "https://files.pythonhosted.org/packages/b1/84/7f368f3d4ea0db2bd8798675dd3400eb6fd097a9b2d8197b32afa59ff2cf/midi-player-0.5.1.tar.gz",
"platform": null,
"description": "# midi-player\nPython launcher of the [`html-midi-player`](https://github.com/cifkao/html-midi-player) by [@cifkao](https://github.com/cifkao) & [@magenta](https://github.com/magenta)\n\nWorks with local and web-hosted MIDI files in Jupyter, Colab, WandB,...probably other contexts. \n\n# Installation\n\n```\npip install midi-player\n```\n\n# Usage\n\nOnly tested with Jupyter Notebooks & Colab, but uses no IPython dependencies so it *should* work in other contexts.\n```python\n\nfrom midi_player import MIDIPlayer\nfrom midi_player.stylers import basic, cifka_advanced\n\nmidi_file_url = \"https://magenta.github.io/magenta-js/music/demos/melody.mid\"\nmidi_file = \"data/test_midi.mid\"\n\nMIDIPlayer(midi_file_url, 400) \nMIDIPlayer(midi_file, 160, styler=cifka_advanced, title='My Player')\n```\n\nWith `wandb`:\n```python\nimport wandb\n\nwandb.login()\nwandb.init(project=\"midi-player\")\nmp = MIDIPlayer(midi_file, 300, viz_type=\"waterfall\")\nwandb.log({'player':wandb.Html(mp.html)})\nwandb.finish()\n\n```\n\nSee `examples/` for more.\n\n# Documentation\n\nTO-DO. Particularly, people will want to know how to add/customize their own \"stylers\". \nSee `midi_player/*.py` for now ;-).\n\n# Known Issues / Release Notes\n* Not sure why the staff view is putting out 32nd notes / how to tell it to do 8th notes instead.\n* v0.5.1: Lightened title text color in Dark Mode for better visibility on dark backgrounds\n* v0.5: Added `title=` kwarg, as workaround b/c Quarto mixes up ordering of `print` and IFrame elements\n* v0.4: Refactored `stylers.py`. Added a `dark` mode styler. \n* 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. \n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python launcher of animated MIDI player by @cifkao & @magenta",
"version": "0.5.1",
"project_urls": {
"Homepage": "https://github.com/drscotthawley/midi-player",
"Source": "https://github.com/drscotthawley/midi-player"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5685cdacc44b0227156dbcdc237b8ee89d87df2c92e70aa5b08a13fcb3220ee2",
"md5": "d4e854ad1db734e5a52ac0edfafdaabd",
"sha256": "0efad3801b57edf1176054bd9a8647aa5a7c1001ba65c2377080f365a51a7bb4"
},
"downloads": -1,
"filename": "midi_player-0.5.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d4e854ad1db734e5a52ac0edfafdaabd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6390,
"upload_time": "2023-12-13T03:10:25",
"upload_time_iso_8601": "2023-12-13T03:10:25.457297Z",
"url": "https://files.pythonhosted.org/packages/56/85/cdacc44b0227156dbcdc237b8ee89d87df2c92e70aa5b08a13fcb3220ee2/midi_player-0.5.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b1847f368f3d4ea0db2bd8798675dd3400eb6fd097a9b2d8197b32afa59ff2cf",
"md5": "5a04806792c35049af6c2275c21c0eeb",
"sha256": "a1f6f89ec83ee510a58986f584309175b18f1265e842ce48b33c4de0a5f520a0"
},
"downloads": -1,
"filename": "midi-player-0.5.1.tar.gz",
"has_sig": false,
"md5_digest": "5a04806792c35049af6c2275c21c0eeb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5745,
"upload_time": "2023-12-13T03:10:27",
"upload_time_iso_8601": "2023-12-13T03:10:27.635463Z",
"url": "https://files.pythonhosted.org/packages/b1/84/7f368f3d4ea0db2bd8798675dd3400eb6fd097a9b2d8197b32afa59ff2cf/midi-player-0.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-13 03:10:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "drscotthawley",
"github_project": "midi-player",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "midi-player"
}