ShowScore
Music21 is an excellent library for working with music notation in Python. However, to render sheet music you need to install an external program and configure paths. ShowScore can render scores beautifully, without any dependencies (and faster to boot!). We do this by using OpenSheetMusicDisplay, an open-source music renderer written in JavaScript.
Usage
from music21 import *
# Your ABC notation as a string
abc_notation = "X:1\nT:My Tune\nM:4/4\nK:C\nCDEF|G2G2|A4|G2F2|E4|"
# Load the ABC notation from the string
score = converter.parse(abc_notation)
from showscore import show
show(score)
from showscore import show
from music21 import corpus
score = corpus.parse('bwv565')
# score will be rendered below cell:
show(score)
# open score in new tab:
show(score, tab=True)
Options
showscore.backend- currently one of 'canvas' (default) or 'svg'- canvas is more performant and less laggy - but won't resize automatically
- use
showscore.backend = 'svg'to use svg renderer
show(score, title=True, tab=False)title- false to hide titletab- open in new tab rather than inline
Known bugs
Some corpus pieces give rendering errors. E.g. 'bach/bwv846' has an error in Chrome. These are bugs in the OS If a piece fails to render it will display the error message in red.
- Several pieces (e.g. 'bach/bwv846') will display 'Error rendering data:TypeError: Cannot read properties of undefined (reading 'TempoExpressions')' this is a bug in OpenSheetMusicDisplay. For now use the fix below.
- If you see anything else open an [Issue
from music21 import corpus
from showscore import show
score = corpus.parse('bach/bwv846') # Prelude in C
# filter out metronome marks to fix rendering error
for el in score.recurse().getElementsByClass('MetronomeMark'):
el.activeSite.remove(el)
show(score)
Tested in
- VSCode Notebooks
- Jupyter lab
Metadata
Release files for showscore 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| showscore-0.1.4.tar.gz | 300.1 kB | Without provenance | Details for showscore-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| showscore-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for showscore-0.1.4-py3-none-any.whl |
Total release size: 601.6 kB
Release files / showscore-0.1.4.tar.gz
| Download URL | showscore-0.1.4.tar.gz |
|---|---|
| Size | 300.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
587c815852ff15aafdc8f9e5956e4e5cadef711398be8cec970979cccdaafa60
|
|
BLAKE2b-256 checksum How to use checksums |
e1dd19d38e51ed381f6eafda9afca17cef539015a94b23c083bb3a8e0453e0e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / showscore-0.1.4-py3-none-any.whl
| Download URL | showscore-0.1.4-py3-none-any.whl |
|---|---|
| Size | 301.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2cd3e38f8d703dbcb7b7262724a9916b3649e001bb2377b0d14d7ea1f622163
|
|
BLAKE2b-256 checksum How to use checksums |
cdce595ac594b1d3e6deb87be50dde63565d5624090dbcdda84bfebaeddfff45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Security for showscore 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.