Skip to main content

musdl

logo

Code style: black PyPI - Downloads PyPI - License PyPI PyPI - Python Version Lines of code

NOTE

The author of musdl does NOT condone piracy in any way, and is not responsible for anything that happens as a result of piracy arising from the use of musdl.

musdl (musscore downloader) is a downloader for Musescore, written in Python.

The easiest way to download the score is through the CLI:

musdl (musescore url)

To convert to another format, use -f/--format:

# export as midi
musdl -f mid (musescore url)

For a complete list of formats, run musdl --help. If you want to export in any format besides mscz, you need to install musescore first.

It can also be imported and used as a module:

from musdl import Score, OnlineScore

my_score = OnlineScore("musescore_url")

# Read the score's metadata,
name = my_score["workTitle"]
# or save the whole score...
my_score.export("mscz", "my_score.mscz")

# ...and then load it again.
my_score = Score.from_file("my_score.mscz")

For API documentation, see here.

How it works

I just copied over the IPNS-specific constants and used them to download the score file from Xmader's dataset.

Other approaches were considered:

  • Create a native Python interpreter just to decode the musescore js (like Js2py). (Will problably break with every API change.)
  • Use a headless JS browser with Selenium. (Resource-heavy, not really cross-platform.)
  • Run a JS engine like PyMiniRacer/PyQt5. (Better speed, but needs C extensions.)

So I decided to roll with the IPNS dataset.

takedown request, et tu

Take a look at this issue in the same repo.

Hacking

All my python projects now use flit to build and publish. So you need to python3 -m pip install flit first.

flit build

Install

(python3 -m) pip install musdl

Optionally, to export the score in other formats (midi, mp3, etc.) install musescore. musdl relies on its command-line tool mscore to export scores:

# Linux
sudo (package manager/snap) install musescore
# Windows
scoop bucket add extras  # add the extras bucket if you haven't
scoop install musescore

License

MIT.

Metadata

Release files for musdl 3.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for musdl 3.1.8
File Size Uploaded Provenance Actions
musdl-3.1.8.tar.gz 22.3 kB Without provenance Details for musdl-3.1.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for musdl 3.1.8
File Interpreter ABI Platform Actions
musdl-3.1.8-py3-none-any.whl Python 3 none any Details for musdl-3.1.8-py3-none-any.whl

Total release size: 30.3 kB

Release files / musdl-3.1.8.tar.gz

Download URL musdl-3.1.8.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
eae6d1b7e6e02b75809df17f8279db6b214803e79b910f917cca00b0742112ef
BLAKE2b-256 checksum
How to use checksums
a2b7ff004395abdb15f94f42614a2c03a71cffd5bc7b4f0f002169c9443c468d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.25.1

Release files / musdl-3.1.8-py3-none-any.whl

Download URL musdl-3.1.8-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac4d11455d40198dec4dd6383c83866a99f3267a4850702ded96285db61c38ec
BLAKE2b-256 checksum
How to use checksums
b3df503538987e91ca1a90ccd60b6994f2f0e7e75d31ebe3765d2a5f7e50998a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.25.1

Security for musdl 3.1.8

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page