playscan
Python client for the PlayScan API: send photos or PDFs of
printed sheet music, get back MusicXML, compressed MusicXML (.mxl) or MIDI.
Install
pip install playscan
Requires Python 3.9+. The only dependency is requests.
Quickstart
Get a key at developer.playscan.app (new accounts get 10 free pages once, no card), then:
from playscan import PlayScan
result = PlayScan(api_key="ps_live_...").scan("page1.jpg")
print(result.save()) # score.musicxml
If you leave out api_key, the client reads PLAYSCAN_API_KEY from the environment. Keep the key on
the server: the API does not accept browser (CORS) requests.
More options:
client = PlayScan() # PLAYSCAN_API_KEY
# Several images = several pages of one score, in order.
result = client.scan(["p1.jpg", "p2.jpg"], format="midi")
result.save("song.mid")
# A PDF, only pages 2-4, with progress output.
result = client.scan(
"book.pdf",
format="mxl",
page_range=(2, 4),
on_progress=lambda s: print(s.status, s.progress),
)
print(result.charged_pages, "pages charged,", result.balance_pages, "left")
files can be a path, bytes, a binary file object, or a list of them.
Command line
export PLAYSCAN_API_KEY=ps_live_...
playscan scan page1.jpg page2.jpg -f midi -o song.mid
playscan scan book.pdf --pages 1-3 # saves score.musicxml
playscan balance # pages left
Progress goes to stderr, the saved path to stdout. On an API error the command prints
error <code>: <message> and exits with code 1.
API
| Method | What it does |
|---|---|
scan(files, format="musicxml", page_range=None, poll_interval=2.0, wait_timeout=600, on_progress=None) |
Create a scan, wait, download. Returns a Result. |
create_scan(files, page_range=None) |
Upload and start a scan. Returns Scan(id, status, pages, deduplicated). |
get_scan(id) |
Returns ScanStatus(id, status, progress, pages, charged_pages, error, queue_position, eta_seconds). |
wait(id, poll_interval=2.0, wait_timeout=600, on_progress=None) |
Poll until done. Returns the final ScanStatus. |
download(id, format="musicxml") |
Result bytes. format: musicxml, mxl, midi or zip. Free and repeatable. |
cancel(id) |
Cancel a scan that is still queued. |
balance() |
Pages left on the account. |
Result has content, format, filename, scan_id, charged_pages, balance_pages and
save(path=None), which writes the file (by default to filename in the current directory; a directory
path gets filename inside it, missing folders are created) and returns the path.
Constructor: PlayScan(api_key=None, *, base_url="https://api.playscan.app", timeout=120, max_retries=5).
base_url can also come from PLAYSCAN_BASE_URL.
Uploading the same files with the same options again returns the existing scan
(deduplicated=True) and is not charged again.
Errors
API errors and wait errors are playscan.PlayScanError with status, code, message, retry_after and
body. Invalid arguments (for example an unknown format or a bad page_range) raise ValueError or
TypeError, and a file path that cannot be read raises OSError.
ScanFailedError: the scan ended asfailedorcanceled.codeis the scan's error code (for exampleno_staff_lines) orcanceled;scan_idis attached.ScanTimeoutError:wait_timeoutpassed. The scan keeps running on the server; callwait(e.scan_id)again later.
Common codes: unauthorized (401), insufficient_balance (402), not_found (404),
unsupported_file / too_many_pages / upload_too_large (422), too_many_active (429),
result_expired (410). The client retries rate_limited (429) and busy (503) on its own, waiting the
Retry-After time, up to max_retries times. It does not retry too_many_active.
Limits
- JPEG, PNG or TIFF images, or exactly one PDF; up to 30 pages per scan.
- 30 MB per file, 60 MB per upload.
- 2 active scans per account; 10 new scans and 120 requests per minute.
- Results can be downloaded for 24 hours. Uploaded images are deleted after 24 hours and are not used to train models.
- Printed music only, not handwriting. Recognition is automatic and can make mistakes; check the result.
Pricing
Pay per page with one-time packs, no subscription, pages never expire: $10 / 100, $40 / 600, $125 / 2,500, $350 / 10,000 pages. Only pages that were read are charged; failed pages go back to your balance.
Links
- Sign up and get a key: https://developer.playscan.app/?ref=pypi
- Docs: https://developer.playscan.app/docs?ref=pypi
- OpenAPI spec: https://developer.playscan.app/openapi.json?ref=pypi
- Tutorial: https://developer.playscan.app/guides/sheet-music-to-musicxml?ref=pypi
- Try it in the browser, no account: https://playscan.app/en/try?ref=pypi
License
MIT
Metadata
Release files for playscan 0.1.0
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 |
|---|---|---|---|---|
| playscan-0.1.0.tar.gz | 9.4 kB | Without provenance | Details for playscan-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| playscan-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for playscan-0.1.0-py3-none-any.whl |
Total release size: 21.4 kB
Release files / playscan-0.1.0.tar.gz
| Download URL | playscan-0.1.0.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
10f6072ef26ed54823b2fd57ac989acde843058009b782798eca0a7940ecfa82
|
|
BLAKE2b-256 checksum How to use checksums |
f781d44e0089cd14ac8e45fa0e9da50efde8bd10b55127d465a02f9352d23afa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / playscan-0.1.0-py3-none-any.whl
| Download URL | playscan-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c664bd9967e6040d6de0f0a0eb3febb045149d2df971bbd26719eaf2947e392
|
|
BLAKE2b-256 checksum How to use checksums |
7af61e1807c0f2614cf4e0e5f19bbfa5ea8b3579ab2da81e919f33ee942efa61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for playscan 0.1.0
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.