Repository navigation
2.9.0 — a score you can play along with
A score you can play along with. This release brings @zamvar's fork
(codex/note-tap) upstream in five slices: pickup bars, .mxl import, tap
callbacks, a playback transport with an on-screen cursor, and a paged view.
Each was rebuilt on the 2.8 engine instead of being copied, so taps go through
ScoreHitTester, timing comes from the same MidiSequence that makes the
sound, and pages are bands of the one GrandStaffPainter that the screen and
PDF export share. Discussion #50 tracks the port, and every slice credits
@zamvar as co-author.
Review of those slices found defects that had nothing to do with the new
features. A one-beat pickup in 4/4 played three beats of silence. A tempo
change never reached native playback. A <forward> gap moved the next note
early. A bar holding only voice 5 imported empty. Every system of a grand staff
ended on a final barline. Each one now has a regression test that fails
without its fix. @ArtSilver's #49 fixes beaming in bars that inherit their
meter (#47).
Minor rather than patch, because it adds public API and changes no existing
behaviour except the defects listed under Fixed. Three goldens change: they
now show staff lines stopping at the closing barline, and a single barline
between systems.
Added — paged view
PagedScoreViewandPagedScoreController. AScoreshown as paper
pages, one at a time, swiped left and right. Pages are A4 portrait by
default (pageSize,pageMargin), and the first opens with the title,
subtitle and composer. Pinch orzoomByzooms a page (1x to 4x, kept per
page). Taps and the playback cursor work as onGrandStaff, and with
followPlaybackthe page turns to keep the cursor in view. Each page is a
clipped band of the oneGrandStaffPainterthat the screen and the PDF
exporter share.GrandStaffPainter.pages(maxHeight:)cuts the systems into
pages, andsystemOfMeasure/pageOfSystemlocate a bar. Fifth and last
slice of @zamvar's fork (Discussion #50).GrandStaffPainterpaints only the systems its clip can show. A page
ofPagedScoreViewno longer repaints the whole score.
Added — playback cursor
playbackPositiononMusicScore,GrandStaffandScoreView. It is a
ValueListenable<PlaybackPosition?>, typically fed from
PlaybackPlan.positionAton each clock tick, and draws a cursor across the
staff or the whole system. The cursor is its own layer behind its own
RepaintBoundary, so a tick repaints one line, not the notation. It glides
between the bar's rhythmic events on the shared grid, so it reaches each
note, on any staff, as that note starts to sound.PlaybackPositiongains
measureLength, andMusicScoreThemegainsplayheadColor.
GrandStaffPainter.playheadAtgives the placement to a custom host. Fourth
slice, part b, of @zamvar's fork (Discussion #50); part of #19.
Added — playback transport
PlaybackPlan(fromStaff,fromScore,fromSequence): the
transport a player UI needs, read off the sameMidiSequencethat makes the
sound, so cursor, highlighting and audio cannot disagree.positionAt(time)
gives the bar, repeat pass, offset in the bar (in whole notes, the unit of
PositionedElement.onset) and progress.notesAt(time)gives the written
notes sounding then.timeOfMeasure(index, repeatPass:)gives where to seek.
timeAtTick/tickAtconvert through every tempo change. Fourth slice of
@zamvar's fork (Discussion #50); the fork re-derived timing on its own.MidiSequence.playedMeasuresandnoteSpans. The bars in playing order
with their ticks, repeats expanded, and oneMidiNoteSpanper written note
per pass. Each span carries the caller's ownNote, its staff, voice, bar,
pass and written ticks. A chord gives one span per note; grace notes take no
time and have none; split voice tracks still give one span per note.
Added — tap callbacks
onNoteTapandonMeasureTaponMusicScore,GrandStaffand
ScoreView. A note tap reports the caller's ownNote(a chord tap reports
the chord note nearest the tap), with its bar, staff and local/global
position, as aScoreNoteTap. A bar tap reports the bar's index and
printed number (a pickup is 0) as aScoreMeasureTap. Both are resolved
throughScoreHitTester, so a tap lands on the boxes the 2.8.0 hit-test
fixes measured: the stem tip, the whole flag, the full width of a rest.
GrandStaffPainter.noteTapAt/measureTapAtdo the same for a custom
host. Without a callback, no gesture detector is added. Third slice of
@zamvar's fork (Discussion #50), which resolved taps with geometry of its
own; this rebuilds them on the shared hit tester.
The first two slices of @zamvar's fork (codex/note-tap), ported onto the
2.8 engine — see Discussion #50. Their MuseScore 4.7.4 reference export
(CC0-1.0) now ships as a test fixture, and on its first import it surfaced a
data-loss bug in both XML importers.
Added — compressed MusicXML
.mxlfiles open.MusicXMLParser.scoreFromBytes,
parseMusicXMLBytesanddecodeBytestake a file's bytes and tell a
compressed.mxl(a ZIP whoseMETA-INF/container.xmlnames the score)
from plain MusicXML by its signature, not its file name. Plain bytes are
decoded as UTF-8, or UTF-16 with a byte-order mark. A corrupt archive, a
container naming no rootfile or a missing file, a rootfile path climbing out of the
archive, or an archive with no score is aFormatException..mxlis the
default save format of MuseScore, Finale, Sibelius and Dorico, and before
this every importer took a String.archive(already in the
dependency graph) is now a direct dependency.
Added — pickup bars
Measure.isImplicitmarks a pickup (anacrusis) or another bar left out
of the count. It is imported from MusicXMLimplicit="yes", MEI
metcon="false"on a pickup (the first bar, or one numbered 0) and JSON
"implicit": true, and exported to MusicXML and
JSON. Measured on a one-quarter pickup in 4/4: bar 1 started at tick 3840,
after three beats of silence, and now starts at 960, because MIDI sizes an
implicit bar from its content instead of its meter. Layout no longer counts
it when numbering (pickup = bar 0, first full bar = bar 1, inMusicScore
and in everyGrandStaffsystem), and the layout check tolerates it being
short wherever it stands, not only as the first bar.Measure.isIrregularmarks a short bar that still COUNTS: MEI
metcon="false"away from a pickup, JSON"irregular": true. It keeps its
bar number but, like an implicit bar, plays only as long as its content and
may be shorter than the meter. Counting and duration are separate facts;
with one flag for both, a mid-piece half-note bar in 4/4 either stole the
next bar's number or played two beats of silence (review on #51).- MusicXML export writes the displayed bar number, not the position. An
unnumbered pickup was writtennumber="1", read back as an explicit 1, and
the first full bar then showed as 2. It is written0now, and an
unnumbered implicit bar after the start is writtenX1,X2, … as MuseScore
does. The counting rule lives inMeasure.displayNumbers
(LayoutEngine.displayMeasureNumbersdelegates to it). - Bar numbers are read back. MusicXML
@numberand MEI@nnow populate
Measure.number(a non-integer token such asX1staysnull). JSON
import now reads the"number"thatJsonMusicExporterhad always
written.
Fixed — wrapped systems
- Only the last system ends with the final barline.
GrandStaffPainter
lays out each system as its own sub-staff, and the layout closed every
sub-staff as if the piece ended there, so every line of a grand staff ended
thin-thick.LayoutEnginegainscontinuesAfter. - Staff lines stop at a system's closing barline. Lines ran 0.8 spaces
past a single barline at the end of a wrapped system; only a final barline's
width had hidden it. Three goldens (grand_staff_multisystem,
m04e_multi_system,s02_ode_to_joy) change by exactly those line ends
and barlines. - Pages are cut between systems, not on the system block boundary. Cut on
the block, a page showed the next system's high notes along its bottom edge,
and the next page lost them off its top.
Fixed — native playback tempo
- A tempo change reaches native playback. The native backend contract
takes one tempo (setTempo) and converts every tick with it, so
MidiNativeSequenceBridgedropped every tempo change after the start: a bar
going from 60 to 120 bpm played at 60 throughout, and its last two quarters
ran a full second late. The bridge now re-expresses each scheduled tick as
the tick, at the opening tempo, of the moment it really sounds, the same
timePlaybackPlan.timeAtTickgives. It also sends the score's own opening
tempo: it used to send the mapper's default 120, which sits at tick 0 before
the score's firstTempoMark. When the tempo changes, the bridge also
schedules the metronome clicks itself (one per beat of every played bar,
warped the same way) instead of the backend's single-tempo grid, whose
clicks drifted off the notes after the change.MidiPlayedMeasuregains
numerator/denominatorfor that. Reported by review on #53.
Fixed — MIDI
- A
<forward>gap delays the note after it. MIDI skippedSpace
outright, so an imported forward gap advanced no time and the next note
entered early by the whole gap. It also never counted toward a bar's
length.Spacenow consumes its duration like a rest. A grace note no
longer lengthens an implicit bar either: it steals time from its neighbour.
A<forward>that ends an implicit bar now counts toward it too: the
importer only turned a forward intoSpacewhen a later note needed the
gap. The layout clock agrees now too:Measure.musicalValueOfcounted a
Spaceas 0, so notes after a forward gap were drawn earlier than MIDI
played them. All four were reported by review on #51.
Fixed — import
- A bar whose only voice is not voice 1 kept its notes. Both XML importers
read voice 1 on their single-voice path, so a bar holding only voice 5 (a
MuseScore piano's lower staff) or MEI<layer n="3">imported empty. On the
MuseScore reference, the left hand's whole note in bar 2 was lost with an
importer warning. Bars that also carried a clef, key or meter were spared,
because those land in voice 1 and sent the bar down the multi-voice path.
Such a bar is now aMultiVoiceMeasurethat keeps the voice's own number,
because a plainMeasureis voice 1 to MIDI and per-voice solo/mute could
not reach it (review on #51). Pinned by
test/parsers/sole_voice_import_test.dart.
Fixed — beaming
- Bars that inherit their meter beam against it. Auto-beaming read the
time signature a bar carries, so every bar after the one declaring the
meter beamed as 4/4: two bars of 6/8 eighths came out 3+3, then 4+2; 9/8
came out 3+3+3, then 4+4. It now reads the meter in force through
LayoutEngine.timeSignatureOf, like every other consumer. Reported in #47
and fixed in #49 by @ArtSilver; pinned by
test/layout/inherited_meter_beaming_test.dart.
Tests
- 1140 tests pass (1041 at 2.8.1), and
dart analyze lib testis clean.
New suites includetest/interaction/paged_score_test.dart,
playhead_test.dart,score_tap_callbacks_test.dart,
test/midi/playback_plan_test.dart,
test/parsers/musicxml_mxl_import_test.dart,
sole_voice_import_test.dartand
test/layout/inherited_meter_beaming_test.dart. The MuseScore 4.7.4 reference export from
the fork (CC0-1.0) ships as a fixture.