Table Of Contents

Previous topic

music21.musicxml.translate

Next topic

music21.romanText.translate

music21.romanText.base

Objects for processing roman numeral analysis text files, as defined and demonstrated by Dmitri Tymoczko.

RTAtom

Inherits from: RTToken

class music21.romanText.base.RTAtom(src=, container=None)

In roman text, within each measure are definitions of chords, phrases boundaries, open/close parenthesis, and beat indicators. These will be called Atoms, as they are data that is not tagged. Store a reference to the container (a RTMeasure) in each atom.

>>> from music21 import *

RTAtom attributes

Attributes without Documentation: container

Attributes inherited from RTToken: src

RTAtom methods

isAtom()
No documentation.

Methods inherited from RTToken: isAnalyst(), isComposer(), isForm(), isMeasure(), isNote(), isPedal(), isProofreader(), isTimeSignature(), isTitle(), isWork()

RTBeat

Inherits from: RTAtom, RTToken

class music21.romanText.base.RTBeat(src=, container=None)
>>> from music21 import *

RTBeat attributes

Attributes inherited from RTAtom: container

Attributes inherited from RTToken: src

RTBeat methods

getOffset(timeSignature)

Given a time signature, return the offset position specified by this beat.

>>> from music21 import *
>>> rtb = romanText.RTBeat('b1.5')
>>> rtb.getOffset(meter.TimeSignature('3/4'))
0.5
>>> rtb.getOffset(meter.TimeSignature('6/8'))
0.75
>>> rtb.getOffset(meter.TimeSignature('2/2'))
1.0
>>> rtb = romanText.RTBeat('b2')
>>> rtb.getOffset(meter.TimeSignature('3/4'))
1.0
>>> rtb.getOffset(meter.TimeSignature('6/8'))
1.5

Methods inherited from RTAtom: isAtom()

Methods inherited from RTToken: isAnalyst(), isComposer(), isForm(), isMeasure(), isNote(), isPedal(), isProofreader(), isTimeSignature(), isTitle(), isWork()

RTChord

Inherits from: RTAtom, RTToken

class music21.romanText.base.RTChord(src=, container=None)
>>> from music21 import *

RTChord attributes

Attributes without Documentation: quarterLength, offset

Attributes inherited from RTAtom: container

Attributes inherited from RTToken: src

RTChord methods

Methods inherited from RTAtom: isAtom()

Methods inherited from RTToken: isAnalyst(), isComposer(), isForm(), isMeasure(), isNote(), isPedal(), isProofreader(), isTimeSignature(), isTitle(), isWork()

RTCloseParens

Inherits from: RTAtom, RTToken

class music21.romanText.base.RTCloseParens(src=), container=None)
>>> from music21 import *

RTFile

class music21.romanText.base.RTFile

Roman Text File access

RTFile methods

close()
No documentation.
open(filename)
Open a file for reading
openFileLike(fileLike)

Assign a file-like object, such as those provided by StringIO, as an open file object.

>>> fileLikeOpen = StringIO.StringIO()
read()
Read a file. Note that this calls readstring, which processes all tokens. If number is given, a work number will be extracted if possible.
readstr(strSrc)
Read a string and process all Tokens. Returns a ABCHandler instance.

RTHandler

class music21.romanText.base.RTHandler

RTHandler properties

tokens
Get or set tokens for this Handler

RTHandler methods

process(src)
Given an entire specification as a single source string, strSrc. This is usually provided in a file.
tokenize(src)
Walk the RT string, creating RT objects along the way.

RTKey

Inherits from: RTAtom, RTToken

class music21.romanText.base.RTKey(src=, container=None)
>>> from music21 import *
>>> gminor = romanText.RTKey('g:')
>>> gminor
<RTKey 'g:'>
>>> gminor.getKey()
<music21.key.Key of g minor>

RTKey attributes

Attributes inherited from RTAtom: container

Attributes inherited from RTToken: src

RTKey methods

getKey()
No documentation.

Methods inherited from RTAtom: isAtom()

Methods inherited from RTToken: isAnalyst(), isComposer(), isForm(), isMeasure(), isNote(), isPedal(), isProofreader(), isTimeSignature(), isTitle(), isWork()

RTMeasure

Inherits from: RTToken

class music21.romanText.base.RTMeasure(src=)

In roman text, measures are given one per line and always start with ‘m’. Measure ranges can be used and copied, such as m3-4=m1-2 Variants are not part of the tag, but are read into an attribute: m1var1 ii

>>> from music21 import *
>>> rtm = RTMeasure('m15 V6 b1.5 V6/5 b2 I b3 viio6')
>>> rtm.data
'V6 b1.5 V6/5 b2 I b3 viio6'
>>> rtm.number
[15]

RTMeasure attributes

Attributes without Documentation: isCopyDefinition, repeatLetter, number, atoms, tag, variantNumber, data

Attributes inherited from RTToken: src

RTMeasure methods

getCopyTarget()

If this measure defines a copy operation, return two lists defining the measures to copy; the second list has the repeat data.

>>> from music21 import *
>>> rtm = romanText.RTMeasure('m35-36 = m29-30')
>>> rtm.number
[35, 36]
>>> rtm.getCopyTarget()
([29, 30], ['', ''])
>>> rtm = romanText.RTMeasure('m4 = m1')
>>> rtm.number
[4]
>>> rtm.getCopyTarget()
([1], [''])
isMeasure()
No documentation.

Methods inherited from RTToken: isAnalyst(), isAtom(), isComposer(), isForm(), isNote(), isPedal(), isProofreader(), isTimeSignature(), isTitle(), isWork()

RTOpenParens

Inherits from: RTAtom, RTToken

class music21.romanText.base.RTOpenParens(src=(, container=None)
>>> from music21 import *

RTOptionalKeyClose

Inherits from: RTAtom, RTToken

class music21.romanText.base.RTOptionalKeyClose(src=, container=None)

Marks the end of an optional Key area which does not affect the roman numeral analysis. (For instance, it is possible to analyze in Bb major, while remaining in g minor)

>>> from music21 import *
>>> possibleKey = romanText.RTOptionalKeyClose('?)Bb:')
>>> possibleKey
<RTOptionalKeyClose '?)Bb:'>
>>> possibleKey.getKey()
<music21.key.Key of B- major>

RTOptionalKeyClose attributes

Attributes inherited from RTAtom: container

Attributes inherited from RTToken: src

RTOptionalKeyClose methods

getKey()
No documentation.

Methods inherited from RTAtom: isAtom()

Methods inherited from RTToken: isAnalyst(), isComposer(), isForm(), isMeasure(), isNote(), isPedal(), isProofreader(), isTimeSignature(), isTitle(), isWork()

RTOptionalKeyOpen

Inherits from: RTAtom, RTToken

class music21.romanText.base.RTOptionalKeyOpen(src=, container=None)

Marks the beginning of an optional Key area which does not affect the roman numeral analysis. (For instance, it is possible to analyze in Bb major, while remaining in g minor)

>>> from music21 import *
>>> possibleKey = romanText.RTOptionalKeyOpen('?(Bb:')
>>> possibleKey
<RTOptionalKeyOpen '?(Bb:'>
>>> possibleKey.getKey()
<music21.key.Key of B- major>

RTOptionalKeyOpen attributes

Attributes inherited from RTAtom: container

Attributes inherited from RTToken: src

RTOptionalKeyOpen methods

getKey()
No documentation.

Methods inherited from RTAtom: isAtom()

Methods inherited from RTToken: isAnalyst(), isComposer(), isForm(), isMeasure(), isNote(), isPedal(), isProofreader(), isTimeSignature(), isTitle(), isWork()

RTPhraseBoundary

Inherits from: RTAtom, RTToken

class music21.romanText.base.RTPhraseBoundary(src=||, container=None)
>>> from music21 import *
>>> phrase = romanText.RTPhraseBoundary('||')
>>> phrase
<RTPhraseBoundary '||'>

RTTagged

Inherits from: RTToken

class music21.romanText.base.RTTagged(src=)

In roman text, some data elements are tagged: there is tag, followed by some data. In other elements, there is just data. All tagged tokens are subclasses of this class. Examples are Title:

RTTagged attributes

Attributes without Documentation: tag, data

Attributes inherited from RTToken: src

RTTagged methods

isAnalyst()
No documentation.
isComposer()
>>> from music21 import *
>>> rth = romanText.RTTagged('Composer: Claudio Monteverdi')
>>> rth.isComposer()
True
>>> rth.isTitle()
False
>>> rth.isWork()
False
>>> rth.data
'Claudio Monteverdi'
isForm()
No documentation.
isNote()
No documentation.
isPedal()
No documentation.
isProofreader()
No documentation.
isTimeSignature()
TimeSignature header data can be found intermingled with measures.
isTitle()
No documentation.
isWork()

The work is not defined as a header tag, but is used to represent all tags, often placed after Composer, for the work or pieces designation.

>>> from music21 import *
>>> rth = romanText.RTTagged('Madrigal: 4.12')
>>> rth.isTitle()
False
>>> rth.isWork()
True
>>> rth.tag
'Madrigal'
>>> rth.data
'4.12'

Methods inherited from RTToken: isAtom(), isMeasure()

RTToken

class music21.romanText.base.RTToken(src=)

Stores each linear, logical entity of a RomanText. A multi-pass parsing procedure is likely necessary, as RomanText permits variety of groupings and markings.

RTToken attributes

Attributes without Documentation: src

RTToken methods

isAnalyst()
No documentation.
isAtom()
Atoms are any untagged data; generally only found inside of a measure definition.
isComposer()
No documentation.
isForm()
Occasionally found in header.
isMeasure()
No documentation.
isNote()
No documentation.
isPedal()
No documentation.
isProofreader()
No documentation.
isTimeSignature()
No documentation.
isTitle()
No documentation.
isWork()
No documentation.