Music Pack (.mpak) Specification

Living Standard,

This version:
https://github.com/cgarst/MusicPackSpec
Issue Tracking:
GitHub
Editor:
Corey Garst

Abstract

A Music Pack file (extension .mpak) packages one song. It holds the score, the recordings that go with it (original, backing track, stems), and the sync points that align the score to each recording. The file is a ZIP archive of ordinary files, so any language can read and write it.

Conventions

Version 1. Changes within version 1 only add optional features. A change that breaks existing files is a new version. The manifest version field says which version a file uses.

The key words MUST, MUST NOT, SHOULD, SHOULD NOT, and MAY have the meanings defined in RFC 2119.

Tools

A cross-platform desktop GUI, MPAK Manager (tools/mpak_manager/), is included in the repository for reading, validating, and editing .mpak archives on Windows, macOS, and Linux.

1. Goals and non-goals

Goals:

Non-goals:

2. Profiles

A profile is a subset of this specification that a reader can implement on its own. A reader states which profiles it supports. A writer SHOULD target the smallest profile that can hold its data.

Profile Covers Sections
Core Container, manifest, song metadata, the score 3 to 6
Playback Core, plus recordings, sync points and beat files 7, 9
Stems Playback, plus stems 8

A Core reader ignores recordings and sync files. A Playback reader plays stem recordings as ordinary recordings.

3. Container

A .mpak file is a ZIP archive. It uses the ISO/IEC 21320 subset of ZIP, plus ZIP64 where needed. The archive has this layout:

manifest.json     the manifest (section 4)
score/<name>      the score files, byte for byte as supplied (a score that uses externalPath has none; section 6),
                  including the files of alternate scores (section 6.3)
audio/<name>      optional audio files
sync/<name>.json  optional sync files (section 9)
beats/<name>.json optional beat files (section 7, "Beat file")
x-<name>/...      optional extension files of one application (section 13.1)

Rules:

  1. The archive has no mimetype entry, and a writer MUST NOT write one. A reader recognizes a file by its manifest.json (format is mpak), together with the .mpak extension and the media type application/vnd.mpak+zip. A file from an earlier writer can have a mimetype entry. The manifest does not name it (rule 7), so a reader ignores it.

  2. manifest.json MUST be present. It MUST be UTF-8 JSON with no byte order mark, and at most 1 MiB.

  3. Entry names MUST be UTF-8 and use / as the separator. A name MUST be relative and MUST NOT contain a .. segment, an empty segment, a backslash, or a control character. Names MUST be unique, also when compared case-insensitively.

  4. The compression method MUST be Stored or Deflate. Encryption MUST NOT be used.

  5. Audio entries SHOULD be Stored. Audio is already compressed, and a Stored entry lets a reader seek without inflating.

  6. A reader MUST NOT depend on entry order. The manifest MUST NOT hold offsets or checksums of the archive itself, so that a tool can rewrite the archive. Hashes of file contents are fine.

  7. An entry that the manifest does not name is allowed, and readers MUST ignore it. A writer that rewrites a file SHOULD keep such entries.

3.1. Large files and streaming

A file can hold hours of audio, so this specification sets no size limit of its own.

  1. A writer MUST use ZIP64 where the ZIP format requires it: an entry or offset of 4 GiB or more, or 65535 or more entries. A reader MUST read ZIP64.

  2. A reader MUST be able to open a file without reading its audio. Opening needs only the end of the archive, the central directory, the manifest, the score, the sync files, and the beat files. The reader SHOULD read these by random access instead of loading the whole archive into memory.

  3. A reader MUST take sizes, offsets and checksums from the central directory, and MUST ignore any different value in a local header. A writer MAY use data descriptors.

  4. A Stored audio entry is a contiguous byte range of the archive. A reader MAY play or copy it from that range without inflating or copying it. It MAY skip the CRC-32 check for such an entry, because checking it means reading all of it.

  5. A reader that inflates an entry MUST count the output as it inflates and stop at the limits in section 12. It MUST NOT use the sizes in the archive for this count.

  6. A reader MUST NOT hash audio in order to open a file. It MAY check a sha256 of an audio source later, on demand or in the background.

  7. A reader reads the score, the manifest, the sync files, and the beat files whole. A reader MAY refuse a score larger than 256 MiB.

3.2. Directory form

A pack can also be kept as a directory instead of a .mpak file. This suits a store that holds files separately, such as a folder on disk, a cloud drive, or a prefix in object storage, where changing one entry of a ZIP archive means rewriting the whole archive, and where a reader that wants one file can fetch just that file.

A pack in directory form is a directory whose files are the entries of the archive, with the same names, relative to the directory. manifest.json is the file at its root. Each file holds exactly the bytes that the entry would hold in the archive. Everything else in this specification applies unchanged, with "entry" meaning a file of the directory. A pack in directory form and a .mpak file with the same entries are the same pack. Rules:

  1. Recognition. A directory is a pack when it holds a manifest.json that is valid and whose format is mpak. The name of the directory has no meaning. A tool SHOULD NOT end it with .mpak, so that it is not mistaken for an archive. There is no media type.

  2. Names. The name rules of section 3 (rule 3) apply to the path of every file, relative to the pack’s directory, including that two names MUST NOT differ only by case. A reader that cannot read or store a name on its filesystem (a name that the system reserves, or one that another name collides with there) MUST reject that entry. It MUST NOT rename it.

  3. No compression, no listing needed. Every file is stored as it is. Rules 4 and 5 of section 3 and the whole of section 3.1 are about the ZIP container and do not apply, except that a reader still MUST NOT hash audio in order to open a pack. The manifest names every entry that a reader needs, so a reader MUST NOT require a listing of the directory. It reads the manifest, then the files it names. A reader that does list the directory ignores any file that the manifest does not name (section 3, rule 7), and applies the limit on entries in section 12 to what it lists. A reader MAY read any file by range, and MAY play an audio file from the store directly.

  4. Writing in an order that survives an interruption. A directory cannot be replaced at once, so a reader can see it half written. A writer that creates or changes a pack:

    • writes each new or changed file whole (for a store that can, by writing under another name and renaming it, or with a single upload), and writes manifest.json last. manifest.json is the commit point: a pack is what its manifest says.

    • removes a file that it dropped or replaced only after it has written the manifest. A writer MAY remove a file that it replaced or dropped, and SHOULD keep x- files and files it does not recognize (section 13).

    • MUST write size for every score and every file source, and an entries item for every sync file and beat file (section 4, "Integrity"). In an archive these are optional because the central directory gives sizes. A directory has no such record, and without these a reader cannot tell a finished file from one that is still being written.

  5. Reading a pack that may be mid-write. A reader that finds that a file’s size or hash differs from the manifest (section 4, "Integrity") SHOULD treat the pack as being written: read manifest.json and that file once more, and if they still differ, warn as section 4 says and use what it has. A reader MUST NOT delete or repair a file for this.

  6. Writers that overlap. This specification defines no locking. A writer that replaces manifest.json SHOULD first check that it has not changed since the writer read it, by a version, an entity tag, or a hash, and if it has, read it again and merge (section 6.2) before it writes. A store that can write only if the version still matches makes this exact; one that cannot leaves a small gap in which an edit can be lost, but the pack stays valid.

  7. Converting. Packing a directory writes its files as the entries of an archive (section 3), and unpacking an archive writes its entries as files. Neither changes any bytes of a file, nor the manifest, so id and every hash stay valid. Timestamps and permissions are not part of the pack.

  8. externalPath. A score’s externalPath (section 6.1) is resolved inside the directory that contains the pack’s directory, and a reader MUST reject any path that escapes it, as for a .mpak file.

4. Manifest

manifest.json is a JSON object. Its JSON Schema is schema/manifest.schema.json.

Field Type Required Meaning
format "mpak" yes Format marker.
version integer, 1 yes Spec major version. A reader MUST reject a higher value and say so.
id string no The identity of this pack: a name that stays the same when the pack is edited, copied, or moved between devices and libraries. 1 to 64 of A-Z a-z 0-9 _ -. A writer SHOULD use a lowercase UUID: version 4, or version 5 when derived from the primary score (below). See "Pack identity".
createdAt string, date-time no When the file was created.
generator { name, version? } no The software that wrote the file.
song object no Section 5. It can be empty or absent.
scores array yes One or more scores of the song. The first is the primary score. Section 6.
recordings array no Section 7.
entries object no Size and hash of the archive entries that the manifest names by path only (sync files and beat files). See "Integrity".

Other fields are allowed. A reader MUST ignore a field it does not know. A field that is private to an application SHOULD start with x- (section 13).

4.1. Integrity

A manifest can state how big each file it points to is, and its hash, so that a reader, or a tool that keeps the entries as separate files, can tell a complete file from a damaged or half-written one.

"entries": {
  "sync/r1.json": { "size": 1842, "sha256": "..." },
  "beats/r1.json": { "size": 960, "sha256": "..." }
}

All of it is optional in an archive, and none of it is needed to open a file. A pack in directory form MUST carry it (section 3.2, rule 4).

4.2. Pack identity

id names the pack, so that a library, a sync service, or a person can tell that two files are the same song at different moments, without comparing titles. It is not derived from the pack’s contents or from the song metadata, because those change when the pack is edited.

5. Song metadata

song is optional, and every field in it is optional.

Field Type Meaning
title string Song title.
artist string Performing artist.
composer string Composer, for classical and instrumental pieces.
album string Album or release title.
year integer Year of release.
genre string Genre, as free text.
publisher string Publisher of the song or the arrangement.
trackNumber integer Track number on the release.
mediumNumber integer Disc number.
length integer Length of the song in milliseconds.
ids object External identifiers (below).

ids is an object keyed by service. The values are hints that a reader MAY use to match the song to a library. A reader MUST NOT require them, and this specification mandates no lookup (section 10).

"ids": {
  "musicbrainz": {
    "recording": "<uuid>",
    "artist": "<uuid>",
    "release": "<uuid>",
    "releaseGroup": "<uuid>"
  },
  "isrc": "USRC17607839"
}

Defined keys: musicbrainz (object with optional recording, artist, release, releaseGroup, each a UUID string; releaseGroup identifies the album across editions and release identifies a specific edition) and isrc (string). Other keys are allowed.

If title or artist is missing and a reader needs a display name, the reader SHOULD use the first of these that exists:

  1. Metadata inside the score file.

  2. The score’s file name.

  3. The name of the .mpak file.

6. Score

scores is an array of one or more items. Each item describes one score of the song. The first item is the primary score: a reader shows it first and uses it where the specification says "the primary score". The order of the other items is a display order only. Several scores can be in different formats, for example a Guitar Pro file and a PDF, or two arrangements (section 6.2).

Field Type Required Meaning
id string yes Identifier, unique among all the scores and alternates of the file (same character rules as recording ids). Sync refers to a score by it (section 9).
label string no Name for display, such as "Guitar Pro" or "Piano arrangement".
path string unless externalPath Archive path of the score file, under score/.
externalPath string unless path Relative path to a shared PDF file outside the archive (pdf only).
format enum yes gp3, gp4, gp5, gp (Guitar Pro 7 and later), gpx, musicxml (uncompressed MusicXML), mxl (compressed MusicXML), mscz (MuseScore), midi (Standard MIDI File), abc (ABC notation), alphatex (alphaTex, .atex), pdf, txt.
sha256 string yes Lowercase hex SHA-256 of the score file’s bytes.
size integer no Size of the score file in bytes. See "Integrity" in section 4.
name string no The original file name, for display.
origin string no Where the score came from, as a name for people, such as a publisher, a service or an author. Scores of one file with the same origin can be shown as one entry (section 6.4). 1 or more characters.
pages integer no Page count of the PDF file, for pdf.
startPage integer no 1-based first page of this song inside a multi-song PDF (pdf only).
endPage integer no 1-based last page of this song inside a multi-song PDF (pdf only, >= startPage, <= pages).
instruments object array no Instruments the score is for, with their tunings. See below. Informational.
alternates array no Alternate scores that use this score’s sync points. Section 6.3.

6.1. Multi-song PDFs (startPage, endPage, and externalPath)

A single PDF, such as a songbook, can hold several songs. Each song is its own .mpak file, and startPage and endPage give its 1-based inclusive page range inside that PDF. Both fields are allowed only when format is pdf. When both are present, endPage MUST be greater than or equal to startPage. When pages is also present, both startPage and endPage MUST be at most pages. When only startPage is set, the song runs from startPage to the end of the PDF. When only endPage is set, the song runs from page 1 to endPage.

The PDF can be stored inside the archive (path, under score/) or left outside it and referenced by externalPath. With externalPath, several .mpak files for songs from the same book can share one copy of the PDF instead of duplicating it in every archive. Rules for externalPath:

6.2. Several scores

A file can hold several scores of one song, for example a Guitar Pro file and a PDF of the same song, or two arrangements. They need not share a format or a structure. The first is the primary score.

6.3. Alternate scores

An alternate is a score that is derived from another score of the file and keeps its structure, so that the sync points of that score (its parent) are valid for the alternate unchanged. Examples: an easy or simplified arrangement, a version transposed or with different fingering, a bass-only or vocals-only reduction, a MusicXML export of a Guitar Pro score, a re-engraved copy. Alternates are listed in the alternates array of their parent. Each item has all the fields of a score (section 6) except alternates, so an alternate cannot have alternates of its own. Its id and label follow the same rules as for a score.

"scores": [
  { "id": "main", "path": "score/song.gp", "format": "gp", "sha256": "...",
    "alternates": [
      { "id": "easy", "label": "Easy", "path": "score/song-easy.gp", "format": "gp", "sha256": "..." },
      { "id": "xml",  "label": "MusicXML export", "path": "score/song.musicxml", "format": "musicxml", "sha256": "..." }
    ] },
  { "id": "pdf", "path": "score/song.pdf", "format": "pdf", "sha256": "..." }
]

6.4. Origin: scores shown together

origin names where a score came from, such as a publisher, a service, or the person who wrote it. Scores of one file that have the same origin belong together: they are renderings or parts of one set, for example the tablature and the notation of each guitar part from one publisher. A reader MAY show them as one entry, for example one row in a list of the song’s scores, with a way to switch between them inside the song.

7. Recordings

recordings is an ordered array. Each entry is one recording: one performance, in one or more forms (the sources).

Field Type Required Meaning
id string yes Unique in the file. 1 to 64 of A-Z a-z 0-9 _ -.
role string yes What the recording is (below).
label string no Display name.
sources array yes Ordered forms of this recording. May be empty.
sync object no Archive paths of this recording’s sync files, one for each score: a map from a score id to a path. Section 9.
syncFrom string no Id of a recording whose sync points and beat file this one shares, for each score that has no sync entry here, and when this recording has no beats entry.
syncOffsetMs integer no Milliseconds added to the points and beats shared through syncFrom. May be negative. Section 9.
beats string no Archive path of this recording’s beat file, under beats/. One for each recording, not for each score. See "Beat file".
scoreTracks object no Which tracks of each score the audio has or lacks: a map from a score id to { "omits": [...] } or { "only": [...] }. See "Tracks in a recording".
without string array no Ids of stems (recordings with role stem) whose parts are not in this recording’s audio. Section 8.
stemOf, stem, stemsComplete no Section 8.

7.1. Roles

role is an open vocabulary. Defined values:

Suggested values: live, cover, click, lesson. If a reader does not know a role, it shows the label and treats the recording as an ordinary one.

7.2. Tracks in a recording

scoreTracks says which tracks of a score are in the audio. The key is a score id (primary scores and other scores of scores, not alternates). The value has one of two fields, never both:

An index is 0-based in the order that the score file lists its tracks, as for stem.track (section 8). A recording with no entry for a score has all of that score’s tracks, and a reader assumes nothing about them.

The entry MAY also have names: the names of those tracks as the score file gives them, in the same order and the same number as the indexes. It is a check, like stem.trackName. If the track at an index has a different name, the reader ignores the whole entry, because the track order has changed since it was written. A writer that knows the track names SHOULD write names.

A reader MAY use it to mute, hide, or highlight tracks so that the audio and the score agree, for example to play the score’s own sound for the omitted track. It MUST ignore the entry when the score’s sha256 does not match its file, when the score’s format does not list tracks (pdf, txt, abc), when an index is out of range, or when names does not match (above). A wrong mute is worse than none. label is for people only: a reader MUST NOT read track names out of it.

{ "id": "v3", "role": "backing", "label": "Backing track (without Drums)",
  "sync": { "main": "sync/v3.json" },
  "scoreTracks": { "main": { "omits": [1], "names": ["Drums"] } }, "sources": [ ... ] }

7.3. Sources

A recording lists its forms in sources. A reader plays the first source it can play and skips the rest. A reader skips a source type it does not know. That is not an error. If no source is playable, the reader shows the recording as unavailable.

Every source has a type. A source can also have these optional fields:

type Extra fields Meaning
file path (required, under audio/), mime An audio file in the archive.
youtube videoId (required, 11 characters) A YouTube video, played with the service’s own player.
url url (required, http or https), mime Audio at a web address.
embedded score (optional) Audio carried inside a score file itself, for example the audio track of a Guitar Pro 7 or later (gp) file.
external none A recording that exists but has no playable source here. sha256 and durationMs help identify it.

An embedded source has no path: the bytes are in a score file, and the reader extracts them with its own code for that score format. score is the id of the score that holds them, and defaults to the primary score. It names a score of scores, not an alternate. These rules apply:

Other types are allowed. A source of any type MAY appear on any recording, including a stem.

7.4. Default recording

The first recording in recordings is the default. A reader uses it first, and a writer puts the recording it wants used first at the start of the list. There is no separate field for this.

7.5. One source in several recordings

Two recordings MAY list the same source, for example the same YouTube video or the same audio file. A writer does this when it has more than one set of sync points for one performance, such as points from two people or two tools that differ slightly. It gives each recording its own sync entries, and it SHOULD say in each label how they differ, for example "Studio version (alternate sync)". The recording that the writer wants used first goes first (see "Default recording").

A recording has one sync file for each score (section 9), so alternate sync points are separate recordings, not a second entry in one sync map. A reader SHOULD offer them as choices and MUST NOT merge their points. A reader that stores the shared source once (section 6.2) keeps every recording that uses it.

Two recordings that share a source and have identical sync points for every score are duplicates, and a writer SHOULD list only one.

7.6. Timeline

Each recording has one timeline that starts at 0 ms. Sync points (section 9) are positions on that timeline, not on any one source. If you replace a source with another form of the same recording, the points stay valid. A source that starts earlier or later than the timeline says so with offsetMs.

7.7. Beat file

A beat file says where the beats of one recording fall on its timeline, and where its sections begin. It describes the recording only, so it names no score and has no anchor type. It is not sync (section 9). A click track, a tapped grid, and a grid measured from the audio can all be written as one. The recording’s beats field names it. Its JSON Schema is schema/beats.schema.json.

Beats and sync answer different questions. A beat file says when the beats of the recording are. A sync file says where in the score the recording is. Neither replaces the other, and a file can have either, both, or neither.

Beat file (section 7) Sync file (section 9)
Describes The recording alone One score against one recording
Count One for each recording One for each recording and score
Depends on the score format No Yes (the anchor type)
Answers When is each beat, which beats are downbeats, where do sections start Where is the playhead in the score at this time
Moves the score cursor, turns pages No Yes
Gives a metronome, count-in, beat-snapped loops, section loops Yes No
Gives a bar number Never For bar anchors
Needs a score No Yes

What a reader can offer, by what the file holds:

The file holds The reader can offer
Neither The score and the recording side by side, with no cursor
Sync only A cursor in the score. A metronome or count-in only from the score’s own beats (a score with a beat structure, such as Guitar Pro or MusicXML), placed through the sync points. pdf and text scores have none.
Beats only A metronome, count-in, beat counter, beat-snapped loops and section loops that follow the recording, for any score format or none. No score cursor.
Both All of the above.

A beat file matters most for a recording whose score has no beat structure of its own (pdf, txt, abc, and midi without bars) and for a recording that no score is synced to. For a score that does have one, the score and its sync points already give a reader a click list, so the beat file adds the measured downbeats and tempo, the count-in, and the named sections. A beat file is never required. A writer that did not measure or receive the beats leaves it out.

{
  "version": 1,
  "recording": "mix",
  "beats": [
    { "timeMs": 1200 },
    { "timeMs": 1700, "downbeat": true },
    { "timeMs": 2200 }
  ],
  "sections": [
    { "name": "Intro", "type": "intro", "timeMs": 1200 },
    { "name": "Verse 1", "type": "verse", "timeMs": 9200 }
  ]
}

8. Stems

A stem is one part of a mix, such as one instrument. The stems of one split are time-aligned, and a reader plays them together.

{ "id": "mix",  "role": "original", "stemsComplete": true, "sources": [ ... ] },
{ "id": "gtr1", "role": "stem", "stemOf": "mix", "label": "Lead guitar",
  "stem": { "instrument": "guitar", "track": 0, "trackName": "Lead" }, "sources": [ ... ] }
Field Meaning
stemOf Id of the recording this stem was split from. Only with role: "stem". The stem’s audio is time-aligned with that recording (offset 0). Unless the stem has its own sync, it uses that recording’s sync points.
stem.instrument Open vocabulary. Suggested: guitar, bass, drums, vocals, keys, other.
stem.track 0-based index into the primary score’s track list (formats that list tracks only).
stem.trackName Optional. The name of that track, used as a check.
stemsComplete On the recording that the stems were split from: true when the stems add up to the whole mix.

9. Sync

A sync file aligns one score to one recording. It is a JSON file under sync/ (schema: schema/sync.schema.json). It is not a beat grid: the beats and sections of a recording, which do not depend on any score, are a beat file (section 7, "Beat file"). The recording’s sync field refers to it, under the id of the score:

{ "id": "r1", "role": "original", "sources": [ ... ],
  "sync": { "main": "sync/r1-main.json", "pdf": "sync/r1-pdf.json" } }
{
  "version": 1,
  "recording": "r1",
  "score": "main",
  "anchorType": "bar",
  "updatedAt": "2026-11-14T12:00:00Z",
  "points": [
    { "timeMs": 0,     "bar": 0, "occurrence": 0, "pos": 0,   "source": "manual" },
    { "timeMs": 2150,  "bar": 1, "occurrence": 0, "pos": 0,   "source": "tap" }
  ]
}

9.1. Anchor type bar (Guitar Pro, MusicXML, MuseScore, and alphaTex scores)

Field Type Meaning
bar integer ≥ 0 0-based index of the bar in the score’s master bar list, which holds the bars in the order that the file lists them, with repeats not expanded.
occurrence integer ≥ 0 Which pass through that bar, counted in playback order. 0 is the first time the bar is played, and a bar inside a repeat has occurrence 1 on its second pass. The default is 0.
pos number, 0 to 1 Position inside the bar, as a fraction of its length. The default is 0.

Points MUST NOT go backwards in playback order. Between two points, a reader SHOULD interpolate in beats using the score’s tempo map. If the score has no tempo map, the reader SHOULD interpolate linearly in time.

The master bar list of each format is:

9.2. Anchor type pdf

Field Type Required Meaning
page integer ≥ 1 yes 1-based page number in the PDF file (when the score’s startPage and endPage are set, page is between startPage and endPage inclusive, not renumbered from 1).
x number, 0 to 1 with y Horizontal position, as a fraction of the page width.
y number, 0 to 1 with x Vertical position, as a fraction of the page height.

9.3. Anchor type text

Field Type Required Meaning
line integer ≥ 0 yes 0-based line number.
col integer ≥ 0 no 0-based column, counted in Unicode code points.

9.4. Anchor type tick (MIDI scores)

Field Type Required Meaning
tick integer ≥ 0 yes Position in MIDI ticks from the start of the file, in the file’s own time division.

10. Reader requirements

A reader:

  1. MUST open a file with no network access, and MUST NOT make a network request in order to open one.

  2. MUST NOT fetch a url source, or start a youtube source, until the user asks to play that recording.

  3. MUST ignore fields, entries, roles, sources and ids keys it does not know.

  4. MUST reject version greater than it supports, with a message saying the file needs a newer reader.

  5. MUST treat everything inside the archive as untrusted input (section 12).

  6. SHOULD warn when a score’s sha256 (or an alternate’s) does not match the file, and likewise when a size or an entries item (section 4, "Integrity") does not match.

  7. SHOULD NOT fail on a missing optional part. A file with only a score is a valid file.

Library matching, merging a file into a song (section 6.2), MusicBrainz lookups, and similar enrichment are application features. They are outside this specification. A reader MAY use the manifest’s id and song.ids for them.

11. Writer requirements and enrichment

A writer:

  1. MUST follow section 3.

  2. MUST write the manifest fields marked required.

  3. MUST write a valid sync file for each recording and score that it gives sync points to.

  4. MUST store an embedded score file (a score’s path) byte for byte (a txt, abc, or alphatex score as UTF-8).

  5. SHOULD write generator.

  6. SHOULD write audio entries Stored, and MUST use ZIP64 where section 3.1 requires it.

  7. SHOULD write a file in one pass over its audio, without holding the audio in memory.

  8. SHOULD write size for each score and file source and an entries item for each sync and beat file, and MUST keep them true when it changes one of those files (section 4, "Integrity"). In directory form it MUST write them (section 3.2).

  9. SHOULD write id, MUST keep the id of a pack it edits or copies for the same song, and MUST write a new id for a pack of a different song (section 4, "Pack identity").

11.1. Changing a score

sha256 marks the exact bytes that a score’s sync anchors were written against (section 6), so a tool that replaces or edits a score file in an existing pack has to keep that mark true. A writer that does this:

  1. MUST update the score’s sha256 (and pages, for a PDF) to match the new file.

  2. MUST then either confirm that the score’s sync points still apply, or remove them. A writer MUST NOT update sha256 without making that decision.

    • The points still apply when the change keeps the structure that the anchors name: the same bars with the same repeats and jumps, the same pages, the same lines.

    • They do not apply when the change adds or removes bars, reflows a page, or reorders the form.

  3. MUST apply the same rule to an alternate (section 6.3). An alternate has its own sha256, and it stays valid for the primary score’s sync only while it still lines up with that score. If an edit to a score breaks that, the alternate is no longer an alternate and the writer MUST remove it from alternates, or turn it into a score of its own.

  4. MUST NOT apply stem.track links to a changed primary score unless the track order is unchanged.

  5. MUST update or remove each recording’s scoreTracks entry for a changed score when the edit adds, removes, or reorders tracks, the same as for item 4. An entry whose names no longer match is ignored by readers, but a writer MUST NOT rely on that.

A reader or editor that keeps sync points outside the file SHOULD key them by the score’s sha256, and MAY carry them to a new hash only when the user, or the tool that made the edit, says the structure is unchanged. A different hash does not by itself show that the points are wrong, which is why section 10 asks a reader to warn and not to refuse.

11.2. Enrichment

A file is valid if it refers to audio only through youtube or url sources and holds no audio files. Another tool can improve such a file:

  1. Add audio/<name> to the archive.

  2. Prepend a file source to the same recording (or insert it before the source that the audio was made from). Set derivedFrom to the id of that source. If the audio was trimmed or padded, set offsetMs so that the existing sync points stay valid.

  3. Leave the rest of the manifest and the sync files unchanged. Keep unknown fields and x- fields.

This specification defines only the layout of the data. It does not say how to obtain audio. Copying audio from a service can breach that service’s terms and the rights of the people who made the recording. The tool’s author and its users decide whether a tool does that (section 14).

12. Security

A reader MUST protect against:

13. Versioning and extensions

13.1. Extensions

A file MAY carry data that this specification does not define. Extensions let an application keep its own data in the file without a new version and without breaking other readers.

14. Copyright, patents, names