MuseScore scores
You drive the browser yourself; this skill gives you two page scripts and a
CLI for everything after them:
js/search.js and js/fetch-score.js hold the MuseScore knowledge. Each is
one async expression that you evaluate in the page, awaited. It returns a
single JSON string, which you save to a file.
msfetch turns those files into results and score files, and never touches
the browser. That way pinchtab's syntax can change without breaking
anything here. Write the browser steps in whatever syntax pinchtab's own
instructions give you today.
Setup (once per conversation)
bash "$(ls -1dt /mnt/skills/*/web-browser ~/.claude/skills/synced/*/web-browser 2>/dev/null | head -1)/setup.sh"
bash "$(ls -1dt /mnt/skills/*/musescore ~/.claude/skills/synced/*/musescore 2>/dev/null | head -1)/setup.sh"
The second command puts msfetch on PATH. msfetch js search and
msfetch js fetch-score print the scripts' paths. Never re-derive the path.
If you are a subagent, the web-browser setup is the one your brief gave you
(with its --subagent name); don't run it a second time bare.
The browser rules
- Never navigate with
--block-images (or any image or resource
blocking) on musescore.com. It also blocks the page's own fetch() of
score_N.svg, so a tab opened that way gets page 1 and nothing else.
- Look at the screenshot after every navigation. musescore.com sometimes
answers with a Cloudflare "Verify you are human" page. The scripts then
report "not a score page" or "not a search page". Run pinchtab's captcha
solve step, wait until the real page shows, then evaluate again. The
reverse also happens: pinchtab reports a challenge as unsolved or given up
while the real page loaded fine. The page content is what counts.
- The eval must await the Promise the script returns. In today's pinchtab
that's
eval --await-promise. Without it you get {} back.
- Get the script into the eval without retyping it. A batch line
expands
$VARS, so in one bash call: export JS="$(cat "$(msfetch js fetch-score)")", then a batch whose step is
eval --await-promise "$JS" > raw.json. The variable dies with the bash
call, so set it in the same one. The output is several MB; it must go to a
file, never into your context.
Log in
Community scores work logged out; official ones need his login. Both scripts
report who is logged in: results prints it in its header, unpack as
logged_in_as. If it is null and you need an official score, log in through
request-credential the way the web-browser skill describes. Agreed scope: log
in and view scores only. No purchases, favourites, settings or posts.
- The form is at
https://musescore.com/user/login.
- Fields:
#username and #password.
- Submit:
button[name=op]. It stays disabled until React sees keystrokes, so
type into the fields rather than setting their values.
- Success lands on
https://musescore.com/dashboard. Check for that inside
the same run.
Cookies die with the sandbox, so each new conversation logs in again.
1. Search
msfetch search-url "viva la vida coldplay" --type piano-voice --sort views
That prints a results URL. Navigate to it, evaluate search.js and save the
output to search.json, then run:
msfetch results search.json
| flag |
meaning |
--type piano-voice|pvg|solo|any |
instrumentation facet (ids 139, 140, 114) |
--official / --community |
publisher scores only, or uploads by users only |
--any-format |
include PDF-only scores (no MIDI); without it they are filtered out |
--sort relevance|rating|views |
|
--page N |
20 per page |
Choosing:
- The song, not a namesake. Check the title, the artist, and a duration
near the recording's.
- Has MIDI. Keep the default filter. PDF-only scores give SVG pages but no
MIDI, so there's no ABC.
- Fits the question. For melody or lyrics, a score with a Voice part
(Piano-Voice or PVG). For harmony, PVG, which has chord symbols. For a piano
question, Solo.
- Official beats community for accuracy. Hal Leonard and Faber are
transcribed from the recording, in its key. Community scores are often
transposed, simplified or partial. Compare the key column with the
recording's key. A Chris Mann cover in G is not Coldplay's A♭. The column
names the key signature's major/minor pair ("E♭ major, C minor"), not which
one is the tonic.
- When several candidates are close, fetch two and compare.
2. Fetch
Navigate to the score URL, evaluate fetch-score.js (awaited) with its output
saved to raw.json, then:
msfetch unpack raw.json <out-dir> [--pdf]
This writes pages/score_N.svg (PNG for pre-2015 uploads), score.mid,
space.jsonp and meta.json, plus score.pdf with --pdf. It prints a
one-line summary. The eval takes 5–20 s.
| exit |
meaning |
what to do |
| 0 |
every page (plus MIDI unless PDF-only) |
go on |
| 2 |
not a score page, or pages missing |
look at the screenshot (Cloudflare?), read stderr, evaluate again |
| 3 |
jmuse refused every token |
official score: log in. If you are logged in, see "When it breaks" |
| 4 |
a file came from a different score than page 1 |
nothing was saved. Evaluate once more; if it repeats, use his Chrome (pinchtab-windows, after a grant, in your own tab) |
To look at pages, render them to PNG. Don't call cairosvg yourself: MuseScore
writes negative dash lengths that crash it, and render strips them.
msfetch render <out-dir> 1 last # 1-based page numbers or `last`; writes <out-dir>/page_N.png
View one page other than the first before you rely on the content.
MuseScore has been seen serving another score's pages under the right score
id.
3. ABC (optional)
msfetch abc <out-dir> [--voice-track N]
The command aligns MIDI notes to the SVG noteheads, OCRs the lyric glyphs and
writes out.abc (melody plus aligned lyrics) and report.json. It needs SVG
pages, score.mid and space.jsonp. It prints the MIDI streams; if the ABC
picked the piano rather than the voice, rerun with the right --voice-track.
The three outputs are authoritative for different things:
- SVG pages: how it is written. Ties, beaming, spelling, chord symbols,
repeats.
- score.mid: what sounds. Exact pitches and onsets, repeats unrolled.
- out.abc: a derived view for analysis. Its rhythm notation is
reconstructed, so the SVG and MIDI win over it.
How good it is (10–70 s per score):
- Hal Leonard: near-clean. Every note matched, and the lyrics round-trip
through abcjs.
- Faber: every note matched. Verse labels ("1.", "2.") leak into the
lyrics.
- Community: notes mostly right. Lyric OCR is noisy, and MIDI exported
with expressive timing gives odd durations (
B,/8-B,/60). Use the SVG and
MIDI there, not the ABC.
report.json lists flagged measures. Look at those on the page before quoting
them. Known limits: two voices on one staff (the top note wins); only one
stream goes to ABC.
How MuseScore serves a score, and what to check when it breaks
MuseScore has no public API; its REST API was shut down years ago. Everything
below was read off the live site, so expect it to drift. When a
script fails, find which step below changed and fix the script, then tell
Louie what changed and commit the fix to the claude-skills repo
(musescore/). The LibreScore userscript
(github.com/LibreScore/dl-librescore, src/file.ts and src/scoreinfo.ts)
does the same job and is usually updated quickly when MuseScore changes. Read
it through a GitHub tool, never a raw fetch.
Page state. Every page embeds its data in window.UGAPP.store:
page.data.score on a score page: id, title, pages_count,
is_pdf, is_official, is_purchased, parts_names,
instrumentations, keysig.
page.data.scores (plus pagination, filters) on a results page.
user: id 0 when logged out, username, isPro, isProPlus.
If this moves, look for another embedded JSON store (<div class="js-store" data-content>, __NEXT_DATA__) in the HTML.
Page 1 is a static file, which the page preloads:
<link rel="preload" as="image" href="https://musescore.com/static/musescore/scoredata/g/<40-hex hash>/score_0.svg?no-cache=…">.
Do not use og:image: it is a differently rendered thumbnail under
another hash. Old uploads only have score_0.png. Strip any @… size
suffix from the URL.
Pages 2+ and the MIDI come from
GET /api/jmuse?id=<id>&type=img|midi&index=<n>, with header
Authorization: md5(id + type + index + SUFFIX).slice(0, 4). The response is
{info: {url}}, a signed S3 URL that lasts 5 minutes, under the same hash as
page 1.
- SUFFIX was
"111010". The script reads it live from the site's bundles
(/static/public/build/…/*.js) by matching "<suffix>").substr(0,4); the
surrounding code is (e+t+n+"111010").substr(0,4).
- If every request gets 401/403 while logged in, grep the bundles for
jmuse to see what the client sends now.
- The real client also sends
X-MU-FRONTEND-VER, X-Mu-Unified-Id and
sometimes x-mu-cp, which looks like a challenge token. None are
needed so far. If jmuse starts returning an error whose message
triggers a re-challenge in the bundle, those headers are the next thing
to add.
- 404 for an official score means no access: not logged in, or not
entitled.
Layout: space.jsonp sits beside the pages, at
/static/musescore/scoredata/g/<hash>/space.jsonp. It holds measure boxes
in 1200-dpi units plus playback timing. Older SVGs are 72 dpi (width about
600), newer ones 360 dpi; align.py normalises both.
Same-score check: every file's scoredata/g/<hash> must equal page
1's. A mismatch means a decoy or the wrong score. Never "fix" it by
relaxing the check.
Bytes are fetched inside the page, because musescore.com returns 403 to
the sandbox's own HTTP client.
MuseScore listens for a devtoolschange event. dl-librescore suppresses
it, which suggests the site may detect devtools or automation. If decoys
start appearing consistently, suspect this first.
1---2name: musescore3description: "Find a song's sheet music on musescore.com and download it as the page SVGs (vector, every element tagged Note/Lyrics/TieSegment/...), score.mid and the measure layout, logged in as Louie (Pro+, so official Hal Leonard/Faber scores too); optionally turn the vocal line plus lyrics into ABC. Use whenever a music question about a song (its key, chords, melody, phrasing, cadences, how it ends, what an arrangement does) would be answered better from the actual score, or when he asks to grab, pull or download a score from MuseScore."4metadata:5 source: https://skillmd.com/skills/louietyj/musescore6---78# MuseScore scores910You drive the browser yourself; this skill gives you two page scripts and a11CLI for everything after them:1213- `js/search.js` and `js/fetch-score.js` hold the MuseScore knowledge. Each is14 one async expression that you evaluate in the page, awaited. It returns a15 single JSON string, which you save to a file.16- `msfetch` turns those files into results and score files, and never touches17 the browser. That way pinchtab's syntax can change without breaking18 anything here. Write the browser steps in whatever syntax pinchtab's own19 instructions give you today.2021## Setup (once per conversation)2223```bash24bash "$(ls -1dt /mnt/skills/*/web-browser ~/.claude/skills/synced/*/web-browser 2>/dev/null | head -1)/setup.sh"25bash "$(ls -1dt /mnt/skills/*/musescore ~/.claude/skills/synced/*/musescore 2>/dev/null | head -1)/setup.sh"26```2728The second command puts `msfetch` on PATH. `msfetch js search` and29`msfetch js fetch-score` print the scripts' paths. **Never re-derive the path.**30If you are a subagent, the web-browser setup is the one your brief gave you31(with its `--subagent` name); don't run it a second time bare.3233## The browser rules3435- **Never navigate with `--block-images`** (or any image or resource36 blocking) on musescore.com. It also blocks the page's own `fetch()` of37 `score_N.svg`, so a tab opened that way gets page 1 and nothing else.38- **Look at the screenshot after every navigation.** musescore.com sometimes39 answers with a Cloudflare "Verify you are human" page. The scripts then40 report "not a score page" or "not a search page". Run pinchtab's captcha41 `solve` step, wait until the real page shows, then evaluate again. The42 reverse also happens: pinchtab reports a challenge as unsolved or given up43 while the real page loaded fine. The page content is what counts.44- **The eval must await the Promise the script returns.** In today's pinchtab45 that's `eval --await-promise`. Without it you get `{}` back.46- **Get the script into the eval without retyping it.** A batch line47 expands `$VARS`, so in one bash call: `export JS="$(cat "$(msfetch js48 fetch-score)")"`, then a batch whose step is49 `eval --await-promise "$JS" > raw.json`. The variable dies with the bash50 call, so set it in the same one. The output is several MB; it must go to a51 file, never into your context.5253## Log in5455Community scores work logged out; official ones need his login. Both scripts56report who is logged in: `results` prints it in its header, `unpack` as57`logged_in_as`. If it is null and you need an official score, log in through58request-credential the way the web-browser skill describes. Agreed scope: log59in and view scores only. No purchases, favourites, settings or posts.6061- The form is at `https://musescore.com/user/login`.62- Fields: `#username` and `#password`.63- Submit: `button[name=op]`. It stays disabled until React sees keystrokes, so64 type into the fields rather than setting their values.65- Success lands on `https://musescore.com/dashboard`. Check for that inside66 the same `run`.6768Cookies die with the sandbox, so each new conversation logs in again.6970## 1. Search7172```bash73msfetch search-url "viva la vida coldplay" --type piano-voice --sort views74```7576That prints a results URL. Navigate to it, evaluate `search.js` and save the77output to `search.json`, then run:7879```bash80msfetch results search.json81```8283| flag | meaning |84|---|---|85| `--type piano-voice\|pvg\|solo\|any` | instrumentation facet (ids 139, 140, 114) |86| `--official` / `--community` | publisher scores only, or uploads by users only |87| `--any-format` | include PDF-only scores (no MIDI); without it they are filtered out |88| `--sort relevance\|rating\|views` | |89| `--page N` | 20 per page |9091**Choosing:**92- **The song, not a namesake.** Check the title, the artist, and a duration93 near the recording's.94- **Has MIDI.** Keep the default filter. PDF-only scores give SVG pages but no95 MIDI, so there's no ABC.96- **Fits the question.** For melody or lyrics, a score with a Voice part97 (Piano-Voice or PVG). For harmony, PVG, which has chord symbols. For a piano98 question, Solo.99- **Official beats community for accuracy.** Hal Leonard and Faber are100 transcribed from the recording, in its key. Community scores are often101 transposed, simplified or partial. Compare the key column with the102 recording's key. A Chris Mann cover in G is not Coldplay's A♭. The column103 names the key signature's major/minor pair ("E♭ major, C minor"), not which104 one is the tonic.105- When several candidates are close, fetch two and compare.106107## 2. Fetch108109Navigate to the score URL, evaluate `fetch-score.js` (awaited) with its output110saved to `raw.json`, then:111112```bash113msfetch unpack raw.json <out-dir> [--pdf]114```115116This writes `pages/score_N.svg` (PNG for pre-2015 uploads), `score.mid`,117`space.jsonp` and `meta.json`, plus `score.pdf` with `--pdf`. It prints a118one-line summary. The eval takes 5–20 s.119120| exit | meaning | what to do |121|---|---|---|122| 0 | every page (plus MIDI unless PDF-only) | go on |123| 2 | not a score page, or pages missing | look at the screenshot (Cloudflare?), read stderr, evaluate again |124| 3 | jmuse refused every token | official score: log in. If you are logged in, see "When it breaks" |125| 4 | **a file came from a different score than page 1** | nothing was saved. Evaluate once more; if it repeats, use his Chrome (`pinchtab-windows`, after a grant, in your own tab) |126127To look at pages, render them to PNG. Don't call cairosvg yourself: MuseScore128writes negative dash lengths that crash it, and `render` strips them.129130```bash131msfetch render <out-dir> 1 last # 1-based page numbers or `last`; writes <out-dir>/page_N.png132```133134**View one page other than the first before you rely on the content.**135MuseScore has been seen serving another score's pages under the right score136id.137138## 3. ABC (optional)139140```bash141msfetch abc <out-dir> [--voice-track N]142```143144The command aligns MIDI notes to the SVG noteheads, OCRs the lyric glyphs and145writes `out.abc` (melody plus aligned lyrics) and `report.json`. It needs SVG146pages, `score.mid` and `space.jsonp`. It prints the MIDI streams; if the ABC147picked the piano rather than the voice, rerun with the right `--voice-track`.148149The three outputs are authoritative for different things:150- **SVG pages**: how it is written. Ties, beaming, spelling, chord symbols,151 repeats.152- **score.mid**: what sounds. Exact pitches and onsets, repeats unrolled.153- **out.abc**: a derived view for analysis. Its rhythm notation is154 reconstructed, so the SVG and MIDI win over it.155156How good it is (10–70 s per score):157- **Hal Leonard**: near-clean. Every note matched, and the lyrics round-trip158 through abcjs.159- **Faber**: every note matched. Verse labels ("1.", "2.") leak into the160 lyrics.161- **Community**: notes mostly right. Lyric OCR is noisy, and MIDI exported162 with expressive timing gives odd durations (`B,/8-B,/60`). Use the SVG and163 MIDI there, not the ABC.164165`report.json` lists flagged measures. Look at those on the page before quoting166them. Known limits: two voices on one staff (the top note wins); only one167stream goes to ABC.168169## How MuseScore serves a score, and what to check when it breaks170171MuseScore has no public API; its REST API was shut down years ago. Everything172below was read off the live site, so expect it to drift. When a173script fails, find which step below changed and fix the script, then tell174Louie what changed and commit the fix to the claude-skills repo175(`musescore/`). The LibreScore userscript176(github.com/LibreScore/dl-librescore, `src/file.ts` and `src/scoreinfo.ts`)177does the same job and is usually updated quickly when MuseScore changes. Read178it through a GitHub tool, never a raw fetch.1791801. **Page state.** Every page embeds its data in `window.UGAPP.store`:181 - `page.data.score` on a score page: `id`, `title`, `pages_count`,182 `is_pdf`, `is_official`, `is_purchased`, `parts_names`,183 `instrumentations`, `keysig`.184 - `page.data.scores` (plus `pagination`, `filters`) on a results page.185 - `user`: `id` 0 when logged out, `username`, `isPro`, `isProPlus`.186187 If this moves, look for another embedded JSON store (`<div class="js-store"188 data-content>`, `__NEXT_DATA__`) in the HTML.1892. **Page 1** is a static file, which the page preloads:190 `<link rel="preload" as="image" href="https://musescore.com/static/musescore/scoredata/g/<40-hex hash>/score_0.svg?no-cache=…">`.191 **Do not use `og:image`**: it is a differently rendered thumbnail under192 another hash. Old uploads only have `score_0.png`. Strip any `@…` size193 suffix from the URL.1943. **Pages 2+ and the MIDI** come from195 `GET /api/jmuse?id=<id>&type=img|midi&index=<n>`, with header196 `Authorization: md5(id + type + index + SUFFIX).slice(0, 4)`. The response is197 `{info: {url}}`, a signed S3 URL that lasts 5 minutes, under the same hash as198 page 1.199 - SUFFIX was `"111010"`. The script reads it live from the site's bundles200 (`/static/public/build/…/*.js`) by matching `"<suffix>").substr(0,4)`; the201 surrounding code is `(e+t+n+"111010").substr(0,4)`.202 - If every request gets 401/403 while logged in, grep the bundles for203 `jmuse` to see what the client sends now.204 - The real client also sends `X-MU-FRONTEND-VER`, `X-Mu-Unified-Id` and205 sometimes `x-mu-cp`, which looks like a challenge token. None are206 needed so far. If jmuse starts returning an error whose message207 triggers a re-challenge in the bundle, those headers are the next thing208 to add.209 - 404 for an official score means no access: not logged in, or not210 entitled.2114. **Layout**: `space.jsonp` sits beside the pages, at212 `/static/musescore/scoredata/g/<hash>/space.jsonp`. It holds measure boxes213 in 1200-dpi units plus playback timing. Older SVGs are 72 dpi (width about214 600), newer ones 360 dpi; `align.py` normalises both.2155. **Same-score check**: every file's `scoredata/g/<hash>` must equal page216 1's. A mismatch means a decoy or the wrong score. Never "fix" it by217 relaxing the check.2186. **Bytes** are fetched inside the page, because musescore.com returns 403 to219 the sandbox's own HTTP client.2207. MuseScore listens for a `devtoolschange` event. dl-librescore suppresses221 it, which suggests the site may detect devtools or automation. If decoys222 start appearing consistently, suspect this first.