music_xml 2.10.0
music_xml: ^2.10.0 copied to clipboard
A Dart package to parse and serialize MusicXML 4.0.
2.10.0 #
- Add
<text>,<syllabic>and<elision>asLyricText,LyricSyllabicandLyricElision, named after the existingLyricFontandLyricLanguage - Add the
xsd:NMTOKENdata type - Add
Lyric.number, thenumberattribute that tells the verses apart Lyricfollows the content modelsyllabic? text ((elision syllabic?)? text)*. OneLyricItemcovers one<text>with what the model allows in front of it, and it holds theLyricSyllabic,LyricTextandLyricElisionobjects, so<text>attributes have somewhere to live;syllabic,textandelisionstill read as plain valuesLyric.itemsis grouped once, while the lyric is built, and holds the same element objects aschildren, so what is written out and what is read back say the same thing. It is unmodifiable, and editingchildrenby hand does not update it; build a newLyricto change one- A lyric read from a file is written back the way its author wrote it, even where it breaks the content model, because a file is data and not a mistake in code. A list handed to
Lyric()in code is asserted instead, so the mistake shows up where it is made
Round-trip fixes #
<tie>is no longer dropped when a<note>is written back out #60<note>children are written in the order the MusicXML content model requires;<accidental>came after<staff>and<beam>before<stem>, which made the output fail validation<lyric>round-trips with its<syllabic>,<text>and<elision>children and itsnumberandnameattributes
API changes #
LyricItem(syllabic, text, elision)now takes its children as elements:LyricItem(LyricText('ry'), elisionElement: LyricElision('\u00a0'), syllabicElement: LyricSyllabic(Syllabic.end)). Reads such aslyric.items.first.text,.syllabicand.elisionare unchanged.Lyric(items, name)is nowLyric(items, lyricName: ...).Lyric.itemsis read-only; build a newLyricto add or remove items.Lyric.textandLyric.syllabicare gone; readlyric.items.first.textandlyric.items.first.syllabic. Take care withtext:Lyricnow extendsXmlElement, solyric.textstill compiles and returns the deprecatedXmlNode.text, which is the text of every child joined together, not the first syllable.Syllabicmoved to the data types, next to the other MusicXML value types. It is still exported frommusic_xml.dart, so only a direct import of the old file needs a change.Lyric.nameis nowLyric.lyricName.LyricextendsXmlElementso that a note can write it back out, andXmlElement.nameis already the tag name. This is the same namingLyricFont.lyricNameandLyricLanguage.lyricNamehave always used. Replacelyric.namewithlyric.lyricName.
2.9.0 #
- Add standard
<volume>and<pan>children to<midi-instrument> - Add
percentandrotation-degreesdata types - Keep namespaced custom attributes on
<midi-instrument>for app-specific playback state such as mute and solo #58
2.8.0 #
<type>element on notes now round-trips viaNoteType(keeps raw text for non-standard values); addsNoteTypeValueenum andsymbol-sizeattribute #53<accidental>now supports thecautionaryandeditorialyes/no attributes #52- Example app: migrate iOS to Swift Package Manager, fix widget test for MusicXML content, update deployment target #54
- Bump
xmlto^7.0.1; minimum Dart SDK is now3.11.0
2.7.0 #
- Support compressed
.mxlfiles viaMusicXmlDocument.parseMxl(List<int> bytes)#37 - Locates root file via
META-INF/container.xml; falls back to first.xmlin the archive
2.6.0 #
New Features #
<notations>element with<tied>,<slur>,<tuplet>,<fermata>,<articulations>,<ornaments>,<dynamics>,<technical>,<accidental-mark>- Direct
<note>children:<beam>,<stem>,<staff>,<accidental>,<rest>,<dot>,<voice>,<duration> <tie>refactored toXmlElementwithStartStopAttrandtime-onlyattribute- Data type enums:
BeamValue,StemValue,StartStopContinue,TiedType,FermataShape,UprightInverted - Shared element:
<voice>(multi-parent:<note>,<direction>,<forward>) - Moved
lyric.dart,tie.dart,grace.dartintonote/directory
Breaking Changes #
Note.voicechanged frominttoVoice?(use.contentfor the string value)Note.isRestis now a getter (rest != null);Note.restis a typedRest?elementTie.typechanged fromStartStoptoStartStopAttr(use.startStopfor the enum value)
2.5.0 #
<part-group>element withgroup-name,group-name-display,group-abbreviation,group-abbreviation-display,group-symbol,group-barline,group-time,footnote,levelPartListpreserves interleaved order of<part-group>and<score-part>elements viaitems- Data type enums:
GroupSymbolValue,GroupBarlineValue - Shared elements:
<display-text>,<accidental-text>,<footnote>,<level> - Moved
StartStoptodata_types/withStartStopAttrclass
2.4.1 #
- Complete element roundtripping audit — every
XmlElementsubclass now passes properattributes:andchildren:tosuper.tag() - Typed attribute classes:
DecimalAttr,IntAttr,YesNoAttr,ValignAttr,EnclosureShapeAttr,TextDirectionAttr,XmlSpaceAttr - Element fields store typed
XmlAttributeobjects directly for zero-conversion roundtripping - Parse methods use single-pass
for/switchover attributes for O(n) instead of repeatedgetAttributecalls - Proper element classes for layout children:
LeftMargin,RightMargin,TopMargin,BottomMargin,PageHeight,PageWidth,StaffDistance,SystemDistance,TopSystemDistance - Moved data types to
data_types/:AccidentalValue,ClefSign - Fixed
Supports.parseto read XML attributes instead of child elements - Added
Localconstants for common attribute names - Upgraded
xmlto 6.6.1,testto 1.31.0
2.4.0 #
<credit>element withcredit-type,credit-words,credit-symbol,credit-image,link,bookmark- Sealed
CreditContentclass withCredit.image/Credit.contentconstructors - Data type enums:
CreditTypeValue,XLinkActuate,XLinkShow,XLinkType,LeftCenterRight,Valign,ValignImage,TextDirection,EnclosureShape,XmlSpace - Bump SDK to
>=3.2.0for sealed classes
2.3.0 #
<defaults>element withscaling,concert-score,page-layout,system-layout,staff-layout,appearance,system-dividers,music-font,word-font,lyric-font,lyric-language- Data type enums:
MarginType,LineWidthType,NoteSizeType,DistanceType,GlyphType,FontStyle,FontWeight,FontSize
2.2.0 #
<identification>element withcreator,rights,encoding,source,relation,miscellaneous, and<supports>
2.0.0 #
New Features #
- Restructured codebase to mirror the MusicXML 4.0 element hierarchy
- All elements now extend
XmlElement, enabling XML roundtripping (parse and serialize) <unpitched>support for percussion scores<grace>with typed attributes (slash,steal-time-following,steal-time-previous,make-time)<chord>as a typed element<score-partwise>withversion,movement-number,movement-title<part-list>/<midi-instrument>as typed elements- Typed
<attributes>withdivisions,key,time,clef,transposeas child elements <key>withkey-step,key-alter,<key-accidental>(fullAccidentalValueenum)<clef>with typedClefSignenum<backup>/<forward>/<direction>/<sound>as typed elementsPitch.toMidiPitch()andPitch.toPitchString()methods
Breaking Changes #
MusicXmlDocumentdocument.scoreParts->document.score.partList.scorePartsdocument.parts->document.score.parts
Measuremeasure.clefSignature->measure.attributesList.first.clefsmeasure.timeSignature->measure.attributesList.first.timesmeasure.keySignature->measure.attributesList.first.keysmeasure.barline(single) ->measure.barlines(list)measure.numberchanged frominttoNumber(use.value)
Notenote.pitch(wasMapEntry<String, int>) renamed tonote.pitchMapnote.pitchTypeSaferenamed tonote.pitch(now the typedPitchobject)
- Renamed classes
KeySignature->Key(mode is now aModeobject instead ofString)ClefSignature->Clef(sign is now aSignobject withClefSignenum)TimeSignature->Time
ScorePartScorePart.idchanged fromStringtoId(use.value)ScorePart.partNamechanged fromStringtoPartName(use.content)
TempotimePositionremoved (accessible viaSoundparent)
MusicXMLParserStateremoved from public exports (internal implementation detail)
Bug Fixes #
- Fix
Attributes.parsetimes parameter shadowing preventing time signatures from flowing to_fixTimeSignature - Fix
KeyAccidental.parsecrash on unrecognized accidental values (now falls back toAccidentalValue.other) - Fix
Grace.parseparsingmakeTimeattribute twice - Fix
Tempo.qpmgetter returningdynamicinstead ofdouble - Fix
_repairEmptyMeasurebeing a no-op (body was commented out) - Fix floating-point comparison in
_fixTimeSignature(now uses integer cross-multiplication) - Fix
Transpose.parsebeing called twice inAttributes.parse - Remove duplicate pitch parsing in
Note(consolidated intoPitchobject) - Standardize factory constructors to
.parse()(was inconsistent.parse()/.fromXml()) - Rename
chore.darttochord.dart(typo)
1.2.0 #
- Don't throw an exception when the lyric has no text
- Read
movement-title - Identify notes belonging to the same tied note by a shared id
- Refactor ChordSymbol to prevent warnings
- Add
SimpleKindto get the basic form of a chord, i.e.major,minor,augmented,diminished,susorother. With.kind.simple, the simple kind can be read out. - Add
Note.pitchTypeSafeproperty to read out pitch information more easily. - Add
Note.noteDurationTiedto get the complied duration of a tied note. - Add additional note information
Note.isNoteOn,isNoteOff,continuesOtherNote,isContinuedByOtherNote
1.0.4 #
- Public constructor
1.0.3 #
- Upgrade dependencies
1.0.2 #
- Refactor constructors with factory
1.0.1 #
- Remove redundant dependencies
1.0.0 #
- Support parse from xml string.