org.jfugue
Class MusicXmlParser

java.lang.Object
  extended by org.jfugue.Parser
      extended by org.jfugue.MusicXmlParser

public final class MusicXmlParser
extends Parser

Parses a MusicXML file, and fires events for 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. As of Version 3.0, the Parser supports turning MIDI Sequences into JFugue Patterns with the parse(Sequence) method. In this case, the ParserListeners established by a ParserBuilder use the parsed events to construct the Pattern string. MusicXmlParser.parse can be called with a file name, File, InputStream, or Reader

Author:
E.Philip Sobolik

Field Summary
 
Fields inherited from class org.jfugue.Parser
TRACING_OFF, TRACING_ON
 
Constructor Summary
MusicXmlParser()
           
 
Method Summary
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
static void main(java.lang.String[] args)
          Used for diagnostic purposes.
 void parse()
          Parses a MusicXML file and fires events to subscribed ParserListener interfaces.
 void parse(java.io.File fileXMLin)
           
 void parse(java.io.FileInputStream fisXMLin)
           
 void parse(java.io.Reader rXMLin)
           
 void parse(java.lang.String musicXmlString)
           
 
Methods inherited from class org.jfugue.Parser
addParserListener, addParserProgressListener, getTracing, removeParserListener, removeParserProgressListener, setTracing
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MusicXmlParser

public MusicXmlParser()
Method Detail

parse

public void parse(java.lang.String musicXmlString)

parse

public void parse(java.io.File fileXMLin)

parse

public void parse(java.io.FileInputStream fisXMLin)

parse

public void parse(java.io.Reader rXMLin)

parse

public void parse()
           throws JFugueException
Parses a MusicXML file and fires events to subscribed ParserListener interfaces. As the file is parsed, events are sent to ParserLisener interfaces, which are responsible for doing something interesting with the music data, such as playing the music, displaying it as sheet music, or transforming the pattern. the input is a XOM Document, which has been built previously

Throws:
java.lang.Exception - if there is an error parsing the pattern
JFugueException

BPMtoPPM

public 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

Parameters:
bpm -
Returns:

main

public static void main(java.lang.String[] args)
Used for diagnostic purposes. main() makes calls to test the Pattern-to-MusicXML parser. If you make any changes to this parser, run this method ("java org.jfugue.MusicStringParser"), and make sure everything works correctly.

Parameters:
args - not used