Each subconverter should inherit from the base SubConverter object and have at least a parseData method that sets self.stream.
Simple class wrapper for parsing ABC.
Input only
ConverterABC bases
ConverterABC read/write properties
Read/write properties inherited from SubConverter:
ConverterABC methods
Get ABC data, as token list, from a string representation. If more than one work is defined in the ABC data, a Opus object will be returned; otherwise, a Score is returned.
Get MIDI data from a file path. If more than one work is defined in the ABC data, a Opus object will be returned; otherwise, a Score is returned.
If number is provided, and this ABC file defines multiple works with a X: tag, just the specified work will be returned.
Methods inherited from SubConverter:
ConverterBraille bases
ConverterBraille read/write properties
Read/write properties inherited from SubConverter:
ConverterBraille methods
Methods inherited from SubConverter:
Simple class wrapper for parsing Capella .capx XML files. See capella/fromCapellaXML.
ConverterCapella bases
ConverterCapella read/write properties
Read/write properties inherited from SubConverter:
ConverterCapella methods
parse a data stream of uncompessed capella xml
N.B. for web parsing, it gets more complex.
Read a file
Methods inherited from SubConverter:
Simple class wrapper for parsing Humdrum data provided in a file or in a string.
ConverterHumdrum bases
ConverterHumdrum read/write properties
Read/write properties inherited from SubConverter:
ConverterHumdrum methods
Open Humdrum data from a string – calls humdrum.parseData()
>>> humdata = '**kern\n*M2/4\n=1\n24r\n24g#\n24f#\n24e\n24c#\n24f\n24r\n24dn\n24e-\n24gn\n24e-\n24dn\n*-'
>>> c = converter.subConverters.ConverterHumdrum()
>>> s = c.parseData(humdata)
>>> c.stream.show('text')
{0.0} <music21.stream.Part spine_0>
{0.0} <music21.humdrum.spineParser.MiscTandem **kern humdrum control>
{0.0} <music21.stream.Measure 1 offset=0.0>
{0.0} <music21.meter.TimeSignature 2/4>
{0.0} <music21.note.Rest rest>
{0.1667} <music21.note.Note G#>
{0.3333} <music21.note.Note F#>
{0.5} <music21.note.Note E>
{0.6667} <music21.note.Note C#>
{0.8333} <music21.note.Note F>
{1.0} <music21.note.Rest rest>
{1.1667} <music21.note.Note D>
{1.3333} <music21.note.Note E->
{1.5} <music21.note.Note G>
{1.6667} <music21.note.Note E->
{1.8333} <music21.note.Note D>
Open Humdram data from a file path.
Calls humdrum.parseFile on filepath.
Number is ignored here.
Methods inherited from SubConverter:
ConverterIPython bases
ConverterIPython read/write properties
Read/write properties inherited from SubConverter:
ConverterIPython methods
Methods inherited from SubConverter:
ConverterLilypond bases
ConverterLilypond read/write properties
Read/write properties inherited from SubConverter:
ConverterLilypond methods
Methods inherited from SubConverter:
Converter for MEI. You must use an ”.mei” file extension for MEI files because music21 will parse ”.xml” files as MusicXML.
ConverterMEI bases
ConverterMEI read/write properties
Read/write properties inherited from SubConverter:
ConverterMEI methods
MEI export is not yet implemented.
Convert a string with an MEI document into its corresponding music21 elements.
Parameters: |
|
---|---|
Returns: | The music21 objects corresponding to the MEI file. |
Return type: | Stream or subclass |
Convert a file with an MEI document into its corresponding music21 elements.
Parameters: |
|
---|---|
Returns: | The music21 objects corresponding to the MEI file. |
Return type: | Stream or subclass |
Methods inherited from SubConverter:
Simple class wrapper for parsing MIDI and sending MIDI data out.
ConverterMidi bases
ConverterMidi read/write properties
Read/write properties inherited from SubConverter:
ConverterMidi methods
Get MIDI data from a binary string representation.
Calls midi.translate.midiStringToStream.
Get MIDI data from a file path.
Calls midi.translate.midiFilePathToStream.
Methods inherited from SubConverter:
Simple class wrapper for parsing MuseData.
ConverterMuseData bases
ConverterMuseData read/write properties
Read/write properties inherited from SubConverter:
ConverterMuseData methods
Get musedata from a string representation.
Methods inherited from SubConverter:
Converter for MusicXML
ConverterMusicXML bases
ConverterMusicXML read/write properties
Read/write properties inherited from SubConverter:
ConverterMusicXML methods
Load all parts from a MusicXML object representation. This determines the order parts are found in the stream
Open MusicXML data from a string.
Open from a file path; check to see if there is a pickled version available and up to date; if so, open that, otherwise open source.
Override to do something with png...
Methods inherited from SubConverter:
Simple class wrapper for parsing NoteworthyComposer data provided in a file or in a string.
Gets data with the file format .nwctxt
Users should not need this routine. The basic format is converter.parse(“file.nwctxt”)
>>> nwcTranslatePath = common.getSourceFilePath() + os.path.sep + 'noteworthy'
>>> paertPath = converter.parse(r'd:/desktop/arvo_part_o_weisheit.nwctxt')
>>> paertStream = converter.parse(paertPath)
>>> len(paertStream.parts)
4
For developers: see the documentation for parseData() and parseFile() to see the low-level usage.
ConverterNoteworthy bases
ConverterNoteworthy read/write properties
Read/write properties inherited from SubConverter:
ConverterNoteworthy methods
Open Noteworthy data from a string or list
>>> nwcData = "!NoteWorthyComposer(2.0)\n|AddStaff\n|Clef|Type:Treble\n|Note|Dur:Whole|Pos:1^"
>>> c = converter.subConverters.ConverterNoteworthy()
>>> c.parseData(nwcData)
>>> c.stream.show('text')
{0.0} <music21.stream.Part ...>
{0.0} <music21.stream.Measure 0 offset=0.0>
{0.0} <music21.clef.TrebleClef>
{0.0} <music21.note.Note C>
Open Noteworthy data (as nwctxt) from a file path.
>>> paertPath = converter.parse('d:/desktop/arvo_part_o_weisheit.nwctxt')
>>> c = converter.subConverters.ConverterNoteworthy()
>>> c.parseFile(filePath)
>>> c.stream.show()
Methods inherited from SubConverter:
Simple class wrapper for parsing NoteworthyComposer binary data provided in a file or in a string.
Gets data with the file format .nwc
Users should not need this routine. Call converter.parse directly
ConverterNoteworthyBinary bases
ConverterNoteworthyBinary read/write properties
Read/write properties inherited from SubConverter:
ConverterNoteworthyBinary methods
Methods inherited from SubConverter:
Simple class wrapper for parsing roman text harmonic definitions.
ConverterRomanText bases
ConverterRomanText read/write properties
Read/write properties inherited from SubConverter:
ConverterRomanText methods
Methods inherited from SubConverter:
ConverterScala bases
ConverterScala read/write properties
Read/write properties inherited from SubConverter:
ConverterScala methods
Methods inherited from SubConverter:
standard text presentation has line breaks, is printed.
Two keyword options are allowed: addEndTimes=Boolean and useMixedNumerals=Boolean
ConverterText bases
ConverterText read/write properties
Read/write properties inherited from SubConverter:
ConverterText methods
Methods inherited from SubConverter:
a text line compacts the complete recursive representation into a single line of text; most for debugging. returned, not printed
>>> s = corpus.parse('bwv66.6')
>>> s.measures(1,4).show('textline')
u'{0.0} <music21.stream.Part Soprano> / {0.0} <music21.instrument.Instrument P1: Soprano: Instrument 1>...'
ConverterTextLine bases
ConverterTextLine read/write properties
Read/write properties inherited from SubConverter:
ConverterTextLine methods
Methods inherited from SubConverter:
Simple class wrapper for parsing TinyNotation data provided in a file or in a string.
ConverterTinyNotation bases
ConverterTinyNotation read/write properties
Read/write properties inherited from SubConverter:
ConverterTinyNotation methods
Open TinyNotation data from a string or list
>>> tnData = ["E4 r f# g=lastG trip{b-8 a g} c", "3/4"]
>>> c = converter.subConverters.ConverterTinyNotation()
>>> s = c.parseData(tnData)
>>> c.stream.show('text')
{0.0} <music21.meter.TimeSignature 3/4>
{0.0} <music21.note.Note E>
{1.0} <music21.note.Rest rest>
{2.0} <music21.note.Note F#>
{3.0} <music21.note.Note G>
{4.0} <music21.note.Note B->
{4.3333} <music21.note.Note A>
{4.6667} <music21.note.Note G>
{5.0} <music21.note.Note C>
Methods inherited from SubConverter:
ConverterVexflow bases
ConverterVexflow read/write properties
Read/write properties inherited from SubConverter:
ConverterVexflow methods
Methods inherited from SubConverter:
Class wrapper for parsing data or outputting data.
All other Converter types should inherit from this and have ways of dealing with various data formats.
Attributes that should be set:
readBinary = True or False (default False)
registerFormats = tuple of formats that can be handled; eg: ('musicxml',)
registerShowFormats = tuple of format calls that can be handled in .show() and .write()
registerInputExtensions = tuple of input extensions that should be handled in converter
registerOutputExtensions = tuple of output extensions that can be written. Order matters:
the first will be used in calls to .write()
canBePickled = True or False (default True; does not do anything yet)
codecWrite = True or False (default False) if codecs need to be used to write
stringEncoding = string (default 'utf-8') if codecWrite is True, what encoding to use
SubConverter read/write properties
Returns or sets the stream in the converter. Must be defined for subconverter to work.
SubConverter methods
return bool on whether the system is equipped to show in this format.
Default True. Might be False if, say a Lilypond converter is used and Lilypond is not installed.
Called when a string (or binary) data is encountered.
This method MUST be implemented to do anything.
Called when a file is encountered. If all that needs to be done is loading the file and putting the data into parseData then there is no need to do anything except set self.readBinary (True|False).