Expand description
A notation program’s PDF read from its vectors (docs/pdf-import.md).
A PDF that MuseScore, Dorico, Sibelius or Finale wrote holds its music as the engraver set it: every notehead, rest, clef, accidental, flag and dot a glyph of a SMuFL music font at its exact place, every staff line, stem, barline and beam a drawn line or shape, and the words as text. Read from there, a notehead’s pitch is its place on the staff and a note’s length its head, flags or beams and dots: nothing is guessed from a picture, and nothing needs a model or a server, so it runs in the browser.
read_pdf finds the systems (staves a line joins), the parts (staves the barlines join are a
piano’s; a staff with words under it a voice), and reads system after system into .fmn
(docs/transcribing.md), compiling each after the ones before it with fm_transcribe: what
comes out always opens. It takes notes and chords in up to two voices a staff (rests a program
hid are filled in), rests, dots, ties, slurs, accidentals (cautionary ones too), key, time and
clef changes (inside a system too), a pickup, dynamics, fermatas, the common articulations and
ornaments, tuplets, grace and cue notes, tremolos, fingering, glissandos, cross-staff notes, the
barlines (double, final, repeats), endings, the segno and coda, To Coda, Fine, D.S. and D.C.,
printed beams that differ from the beat, and the words of each voice, hyphens and held
syllables included; and over and under the staves (marks.rs) hairpins, words, a tempo and
its metronome mark, rehearsal marks, chord symbols, the pedal and ottava lines. The music
fonts before SMuFL (Sibelius’s, Finale’s, capella’s, Doremi) are read as SMuFL (legacy.rs),
as are LilyPond’s, by its glyphs’ names (lilypond.rs), and MuseScore’s old one (mscore.rs).
A staff’s bar it cannot time (two voices that do not add up however its rests are given out),
or whose notes do not stand where the other staves’ say they start (columns.rs), is left as
a bar’s rest and listed, saying where and why; a scan, or a PDF in a music font it does not
know, is refused.
Structs§
- Audit
- A PDF’s reading and what is suspect in it.
- BarAudit
- A bar’s findings.
- BarPlace
- Where a bar is on its page.
- BarText
- One staff’s lines for one bar:
staffas the.fmnnames it (P.2),barthe bar’s label as itsbarline has it,fmnthe lines (P.2: ...,P.2/2: ...), one a voice. - Choice
- One answer: the bars to replace if it is chosen.
- Note
Mark - A note read, where its head stands.
- Place
- A staff’s bar on its page, and the notes and rests seen in it. Their pitches are sure (a notehead’s place on its staff); what could not be made out is how they share the bar’s time.
- Question
- A question on one or more bars.
- Reading
- A PDF read whole.
- Refusal
- Why a PDF, or one of its systems, could not be read from its vectors.
- Review
- A PDF’s reading and the questions a person answers to settle what the reader could not.
- System
Audit - A system’s findings: its bars’, and the counts that do not agree over the whole system.
- Unread
- A staff’s bar that could not be read.
Functions§
- audit_
pdf - Read a PDF and audit the reading.
- bar_
text_ json - A
BarTextas JSON:{"staff","bar","fmn"}. - describe_
layout - The layout found, in words: each system’s page and staves, and the parts (for looking into a refusal).
- is_
engraved - Whether a PDF looks like a notation program’s own: music-font glyphs on its pages, as text.
Cheap next to
read_pdf; a scan has none. - page_
svg - Page
page‘s (0-based) region[x0, y0, x1, y1](page points, from the top left) drawn as SVG: the glyphs’ outlines, the lines and the filled shapes the PDF draws there, in its own coordinates (the SVG’s view box is the region), on white. - read_
pdf - Read a PDF’s bytes into a score, or say why it cannot be read. A staff’s bar it cannot read
is left as a bar’s rest and listed in
Reading::unread, while those are no more than an eighth of the staves’ bars; past that the PDF is refused for the first of them. - read_
pdf_ leaving read_pdf, leaving up tomax_unreadof the staves’ bars unread (0: none; 1: any number).- read_
pdf_ review - A PDF read for review: never refused for its share of unread bars (a PDF the reader cannot read at all still is: no staff lines, an unknown music font).
- reading_
json - A
Readingas JSON: the.fmn, the MusicXML, the counts, the notices and the bars not read (bar, staff, why, and the place: page from 1, x0, x1, y0, y1).