public final class MusicXmlParser extends Parser
ParserListener
interfaces when tokens are interpreted. The ParserListener
does
intelligent things with the resulting events, such as create music, draw
sheet music, or transform the data.
MusicXmlParser.parse can be called with a file name, File, InputStream, or
ReaderModifier and Type | Field and Description |
---|---|
static java.util.Map<java.lang.String,java.lang.String> |
XMLtoJFchordMap |
Constructor and Description |
---|
MusicXmlParser() |
Modifier and Type | Method and Description |
---|---|
static int |
BPMtoPPM(float bpm)
converts beats per minute (BPM) to pulses per minute (PPM) assuming 240
pulses per second In MusicXML, BPM can be fractional, so
BPMtoPPM takes a float argument |
void |
parse()
Parses a MusicXML file and fires events to subscribed
ParserListener interfaces. |
void |
parse(java.io.File inputFile) |
void |
parse(java.io.FileInputStream inputStream) |
void |
parse(java.io.Reader reader) |
void |
parse(java.lang.String musicXmlString) |
addParserListener, clearParserListeners, fireAfterParsingFinished, fireBarLineParsed, fireBeforeParsingStarts, fireChannelPressureParsed, fireChordParsed, fireControllerEventParsed, fireFunctionParsed, fireInstrumentParsed, fireKeySignatureParsed, fireLayerChanged, fireLyricParsed, fireMarkerParsed, fireNoteParsed, fireNotePressed, fireNoteReleased, firePitchWheelParsed, firePolyphonicPressureParsed, fireSystemExclusiveParsed, fireTempoChanged, fireTimeSignatureParsed, fireTrackBeatTimeBookmarked, fireTrackBeatTimeBookmarkRequested, fireTrackBeatTimeRequested, fireTrackChanged, getParserListeners, removeParserListener
public static java.util.Map<java.lang.String,java.lang.String> XMLtoJFchordMap
public MusicXmlParser() throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
public void parse(java.lang.String musicXmlString) throws nu.xom.ValidityException, nu.xom.ParsingException, java.io.IOException
nu.xom.ValidityException
nu.xom.ParsingException
java.io.IOException
public void parse(java.io.File inputFile) throws nu.xom.ValidityException, nu.xom.ParsingException, java.io.IOException
nu.xom.ValidityException
nu.xom.ParsingException
java.io.IOException
public void parse(java.io.FileInputStream inputStream) throws nu.xom.ValidityException, nu.xom.ParsingException, java.io.IOException
nu.xom.ValidityException
nu.xom.ParsingException
java.io.IOException
public void parse(java.io.Reader reader) throws nu.xom.ValidityException, nu.xom.ParsingException, java.io.IOException
nu.xom.ValidityException
nu.xom.ParsingException
java.io.IOException
public void parse()
ParserListener
interfaces. As the file is parsed, events are
sent to ParserListener
interfaces, which are responsible for
doing something interesting with the music data.
the input is a XOM Document, which has been built previouslyjava.lang.Exception
- if there is an error parsing the patternpublic static int BPMtoPPM(float bpm)
BPMtoPPM
takes a float argumentbpm
-