fl_music_xml_parser
Welcome to the Flutter MusicXML Parser library! This library provides an easy and efficient way to parse MusicXML files into ScoreXml objects within your Flutter applications. MusicXML is a widely used format for representing musical scores, and with this library, you can seamlessly integrate music notation into your Flutter apps.
Features
Load File to MusicXmlParser
MusicXmlParser mxlDocument = MusicXmlParser('assets/Saltarello.musicxml');
ScoreXml scoreXml = mxlDocument.scoreXml;
ScoreXml has data of MusicXML
Movement Title
scoreXml.movementTitle;
Identification
// Composer
scoreXml.identification?.composer;
// Rights
scoreXml.identification?.rights;
// Encoding - Software, EncodingDate
scoreXml.identification?.encoding?.software;
scoreXml.identification?.encoding?.encodingDate;
Defaults
// PageLayout
scoreXml.defaults?.pageLayout?.pageHeight;
scoreXml.defaults?.pageLayout?.pageWidth;
// SystemLayout
scoreXml.defaults?.systemLayout?.systemDistance;
scoreXml.defaults?.systemLayout?.topSystemDistance;
// Appearance
scoreXml.defaults?.appearance?.lineWidth?.stem;
scoreXml.defaults?.appearance?.lineWidth?.beam;
scoreXml.defaults?.appearance?.lineWidth?.staff;
scoreXml.defaults?.appearance?.lineWidth?.lightBarline;
scoreXml.defaults?.appearance?.lineWidth?.heavyBarline;
scoreXml.defaults?.appearance?.distance?.beam, 7.5;
scoreXml.defaults?.appearance?.distance?.hyphen, 60;
...
// Fonts
scoreXml.defaults?.musicFont?.fontFamily;
scoreXml.defaults?.musicFont?.fontSize;
scoreXml.defaults?.musicFont?.fontSizeDouble;
scoreXml.defaults?.wordFont?.fontFamily;
scoreXml.defaults?.wordFont?.fontSize;
scoreXml.defaults?.wordFont?.fontSizeDouble;
Part List
// Score Part
scoreXml.partList?.scoreParts[0].id;
scoreXml.partList?.scoreParts[0].partName;
scoreXml.partList?.scoreParts[0].instrument?.id;
...
// Score Part - Midi Instrument
scoreXml.partList?.scoreParts[0].midiInstrument?.id;
scoreXml.partList?.scoreParts[0].midiInstrument?.midiChannel;
scoreXml.partList?.scoreParts[0].midiInstrument?.midiProgram;
scoreXml.partList?.scoreParts[0].midiInstrument?.volume;
scoreXml.partList?.scoreParts[0].midiInstrument?.pan;
...
Part
scoreXml.part?.partList.length;
scoreXml.part?.partList[0].id;
scoreXml.part?.partList[0].measures.length;
scoreXml.part?.partList[0].measures[0].objects.length;
scoreXml.part?.partList[0].measures.forEach((measure) {
for (var element in measure.objects) {
if (element is Attributes) {
print(
'${element.keyFifths}/${element.keyMode}//${element.timeBeats}/${element.timeBeatType}//${element.clefSign}/${element.clefLine}');
} else if (element is Note) {
print(
'${element.pitch}/${element.duration}/${element.stemValue}/${element.beamValue}');
}
}
print('--------------------------------');
});
To Do List
- Parse Notations
- Parse Lyrics
- Parse Chord
- Parse BarLine
- Enable to Load
.mxlfile
MusicXML Test List
- Telemann.musicxml
- SchbAvMaSample.musicxml
- Saltarello.musicxml : Passed
- MozaVeilSample.musicxml
- MozartTrio.musicxml
- MozartPianoSonata.musicxml
- MozaChloSample.musicxml
- MahlFaGe4Sample.musicxml
- FaurReveSample.musicxml
- Echigo-Jishi.musicxml
- Dichterliebe01.musicxml
- DebuMandSample.musicxml
- Chant.musicxml
- BrookeWestSample.musicxml
- BrahWiMeSample.musicxml
- Binchois.musicxml
- BeetAnGeSample.musicxml
- ActorPreludeSample.musicxml
Development Approach
I believe in developing this library incrementally to ensure robustness and reliability. Starting with the sample files provided on the official MusicXML website, we test and enhance the parser to handle a wide variety of MusicXML elements and attributes. This approach allows us to deliver a stable and comprehensive solution that evolves with each iteration, catering to the diverse needs of music notation applications.