music21.romanText.rtObjects

Translation routines for roman numeral analysis text files, as defined and demonstrated by Dmitri Tymoczko, Mark Gotham, Michael Scott Cuthbert, and Christopher Ariza in ISMIR 2019.

RTAnalyticKey

class music21.romanText.rtObjects.RTAnalyticKey(src='', container=None)

An RTAnalyticKey(RTKeyTypeAtom) only defines a change in the key being analyzed. It does not in itself create a Key object.

>>> gMinor = romanText.rtObjects.RTAnalyticKey('g:')
>>> gMinor
<music21.romanText.rtObjects.RTAnalyticKey 'g:'>
>>> gMinor.getKey()
<music21.key.Key of g minor>
>>> bMinor = romanText.rtObjects.RTAnalyticKey('bb:')
>>> bMinor
<music21.romanText.rtObjects.RTAnalyticKey 'bb:'>
>>> bMinor.getKey()
<music21.key.Key of b- minor>

RTAnalyticKey bases

RTAnalyticKey read-only properties

Read-only properties inherited from ProtoM21Object:

RTAnalyticKey methods

Methods inherited from RTKeyTypeAtom:

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTAtom

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

In RomanText, definitions of chords, phrases boundaries, open/close parenthesis, beat indicators, etc. appear within measures (RTMeasure objects). These individual elements will be called Atoms, as they are data that is not tagged.

Each atom store a reference to its container (normally an RTMeasure).

>>> chordIV = romanText.rtObjects.RTAtom('IV')
>>> beat4 = romanText.rtObjects.RTAtom('b4')
>>> beat4
<music21.romanText.rtObjects.RTAtom 'b4'>
>>> beat4.isAtom()
True

However, see RTChord, RTBeat, etc. which are subclasses of RTAtom specifically for storing chords, beats, etc.

RTAtom bases

RTAtom read-only properties

Read-only properties inherited from ProtoM21Object:

RTAtom methods

RTAtom.isAtom()

Atoms are any untagged data; generally only found inside a measure definition.

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTBeat

class music21.romanText.rtObjects.RTBeat(src='', container=None)

An RTAtom subclass that defines a beat definition. Also contains a reference to the container.

>>> beatFour = romanText.rtObjects.RTBeat('b4')
>>> beatFour
<music21.romanText.rtObjects.RTBeat 'b4'>

RTBeat bases

RTBeat read-only properties

Read-only properties inherited from ProtoM21Object:

RTBeat methods

RTBeat.getBeatFloatOrFrac()

Gets the beat number as a float or fraction. Time signature independent

>>> RTB = romanText.rtObjects.RTBeat

Simple ones:

>>> RTB('b1').getBeatFloatOrFrac()
1.0
>>> RTB('b2').getBeatFloatOrFrac()
2.0

etc.

with easy float:

>>> RTB('b1.5').getBeatFloatOrFrac()
1.5
>>> RTB('b1.25').getBeatFloatOrFrac()
1.25

with harder:

>>> RTB('b1.33').getBeatFloatOrFrac()
Fraction(4, 3)
>>> RTB('b2.66').getBeatFloatOrFrac()
Fraction(8, 3)
>>> RTB('b1.2').getBeatFloatOrFrac()
Fraction(6, 5)

A third digit of 0.5 adds 1/2 of 1/DENOM of before. Here DENOM is 3 (in 5/3) so we add 1/6 to 5/3 to get 11/6:

>>> RTB('b1.66').getBeatFloatOrFrac()
Fraction(5, 3)
>>> RTB('b1.66.5').getBeatFloatOrFrac()
Fraction(11, 6)

Similarly 0.25 adds 1/4 of 1/DENOM… to get 21/12 or 7/4 or 1.75

>>> RTB('b1.66.25').getBeatFloatOrFrac()
1.75

And 0.75 adds 3/4 of 1/DENOM to get 23/12

>>> RTB('b1.66.75').getBeatFloatOrFrac()
Fraction(23, 12)

A weird way of writing ‘b1.5’

>>> RTB('b1.33.5').getBeatFloatOrFrac()
1.5
RTBeat.getOffset(timeSignature)

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

>>> rtb = romanText.rtObjects.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.rtObjects.RTBeat('b2')
>>> rtb.getOffset(meter.TimeSignature('3/4'))
1.0
>>> rtb.getOffset(meter.TimeSignature('6/8'))
1.5
>>> rtb = romanText.rtObjects.RTBeat('b1.66')
>>> rtb.getOffset(meter.TimeSignature('6/8'))
1.0
>>> rtc = romanText.rtObjects.RTBeat('b1.66.5')
>>> rtc.getOffset(meter.TimeSignature('6/8'))
1.25

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTChord

class music21.romanText.rtObjects.RTChord(src='', container=None)

An RTAtom subclass that defines a chord. Also contains a reference to the container.

>>> chordIV = romanText.rtObjects.RTChord('IV')
>>> chordIV
<music21.romanText.rtObjects.RTChord 'IV'>

RTChord bases

RTChord read-only properties

Read-only properties inherited from ProtoM21Object:

RTChord methods

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTCloseParens

class music21.romanText.rtObjects.RTCloseParens(src=')', container=None)

A simple close parenthesis Atom with a sensible default

>>> romanText.rtObjects.RTCloseParens(')')
<music21.romanText.rtObjects.RTCloseParens ')'>

RTCloseParens bases

RTCloseParens read-only properties

Read-only properties inherited from ProtoM21Object:

RTCloseParens methods

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTEllisonStart

class music21.romanText.rtObjects.RTEllisonStart(src='|*', container=None)
>>> phrase = romanText.rtObjects.RTEllisonStart('|*')
>>> phrase
<music21.romanText.rtObjects.RTEllisonStart '|*'>

RTEllisonStart bases

RTEllisonStart read-only properties

Read-only properties inherited from ProtoM21Object:

RTEllisonStart methods

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTEllisonStop

class music21.romanText.rtObjects.RTEllisonStop(src='*|', container=None)
>>> phrase = romanText.rtObjects.RTEllisonStop('*|')
>>> phrase
<music21.romanText.rtObjects.RTEllisonStop '*|'>

RTEllisonStop bases

RTEllisonStop read-only properties

Read-only properties inherited from ProtoM21Object:

RTEllisonStop methods

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTFile

class music21.romanText.rtObjects.RTFile

Roman Text File access.

RTFile bases

RTFile read-only properties

Read-only properties inherited from ProtoM21Object:

RTFile methods

RTFile.close()
RTFile.open(filename)

Open a file for reading, trying a variety of encodings and then trying them again with an “ignore” flag if it is not possible.

RTFile.openFileLike(fileLike)

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

RTFile.read()

Read a file. Note that this calls readstr, which processes all tokens.

If number is given, a work number will be extracted if possible.

RTFile.readstr(strSrc)

Read a string and process all Tokens. Returns a ABCHandler instance.

Methods inherited from ProtoM21Object:

RTHandler

class music21.romanText.rtObjects.RTHandler

RTHandler read/write properties

RTHandler.tokens

Get or set tokens for this Handler.

RTHandler methods

RTHandler.definesMovement()

Return True if this handler has 1 or more movement.

>>> rth = romanText.rtObjects.RTHandler()
>>> rth.process('Movement: 1 \n \n m1')
>>> rth.definesMovements()
False
>>> rth.definesMovement()
True
RTHandler.definesMovements(countRequired=2)

Return True if more than one movement is defined in a RT file.

>>> rth = romanText.rtObjects.RTHandler()
>>> rth.process('Movement: 1 \n Movement: 2 \n \n m1')
>>> rth.definesMovements()
True
>>> rth.process('Movement: 1 \n m1')
>>> rth.definesMovements()
False
RTHandler.process(src)

Given an entire specification as a single source string, strSrc, tokenize it. This is usually provided in a file.

RTHandler.splitAtHeader(lines)

Divide string into header and non-header; this is done before tokenization.

>>> rth = romanText.rtObjects.RTHandler()
>>> rth.splitAtHeader(['Title: s', 'Time Signature:', '', 'm1 g: i'])
(['Title: s', 'Time Signature:', ''], ['m1 g: i'])
RTHandler.splitByMovement(duplicateHeader=True)

If we have movements defined, return a list of RTHandler rtObjects, representing header information and each movement, in order.

>>> rth = romanText.rtObjects.RTHandler()
>>> rth.process('Title: Test \n Movement: 1 \n m1 \n Movement: 2 \n m1')
>>> post = rth.splitByMovement(False)
>>> len(post)
3
>>> len(post[0])
1
>>> post[0].__class__
<class 'music21.romanText.rtObjects.RTHandler'>
>>> len(post[1]), len(post[2])
(2, 2)
>>> post = rth.splitByMovement(duplicateHeader=True)
>>> len(post)
2
>>> len(post[0]), len(post[1])
(3, 3)
RTHandler.tokenize(src)

Walk the RT string, creating RT rtObjects along the way.

RTHandler.tokenizeAtoms(line, container=None)

Given a line of data stored in measure consisting only of Atoms, tokenize and return a list.

>>> rth = romanText.rtObjects.RTHandler()
>>> rth.tokenizeAtoms('IV b3 ii7 b4 ii')
[<music21.romanText.rtObjects.RTChord 'IV'>,
 <music21.romanText.rtObjects.RTBeat 'b3'>,
 <music21.romanText.rtObjects.RTChord 'ii7'>,
 <music21.romanText.rtObjects.RTBeat 'b4'>,
 <music21.romanText.rtObjects.RTChord 'ii'>]
>>> rth.tokenizeAtoms('V7 b2 V13 b3 V7 iio6/5[no5]')
[<music21.romanText.rtObjects.RTChord 'V7'>,
 <music21.romanText.rtObjects.RTBeat 'b2'>,
 <music21.romanText.rtObjects.RTChord 'V13'>,
 <music21.romanText.rtObjects.RTBeat 'b3'>,
 <music21.romanText.rtObjects.RTChord 'V7'>,
 <music21.romanText.rtObjects.RTChord 'iio6/5[no5]'>]
>>> tokenList = rth.tokenizeAtoms('I b2 I b2.25 V/ii b2.5 bVII b2.75 V g: IV')
>>> tokenList
[<music21.romanText.rtObjects.RTChord 'I'>,
 <music21.romanText.rtObjects.RTBeat 'b2'>,
 <music21.romanText.rtObjects.RTChord 'I'>,
 <music21.romanText.rtObjects.RTBeat 'b2.25'>,
 <music21.romanText.rtObjects.RTChord 'V/ii'>,
 <music21.romanText.rtObjects.RTBeat 'b2.5'>,
 <music21.romanText.rtObjects.RTChord 'bVII'>,
 <music21.romanText.rtObjects.RTBeat 'b2.75'>,
 <music21.romanText.rtObjects.RTChord 'V'>,
 <music21.romanText.rtObjects.RTAnalyticKey 'g:'>,
 <music21.romanText.rtObjects.RTChord 'IV'>]
>>> tokenList[-2].getKey()
<music21.key.Key of g minor>
>>> rth.tokenizeAtoms('= m3')
[]
>>> tokenList = rth.tokenizeAtoms('g;: ||: V b2 ?(Bb: VII7 b3 III b4 ?)Bb: i :||')
>>> tokenList
[<music21.romanText.rtObjects.RTKey 'g;:'>,
 <music21.romanText.rtObjects.RTRepeatStart '||:'>,
 <music21.romanText.rtObjects.RTChord 'V'>,
 <music21.romanText.rtObjects.RTBeat 'b2'>,
 <music21.romanText.rtObjects.RTOptionalKeyOpen '?(Bb:'>,
 <music21.romanText.rtObjects.RTChord 'VII7'>,
 <music21.romanText.rtObjects.RTBeat 'b3'>,
 <music21.romanText.rtObjects.RTChord 'III'>,
 <music21.romanText.rtObjects.RTBeat 'b4'>,
 <music21.romanText.rtObjects.RTOptionalKeyClose '?)Bb:'>,
 <music21.romanText.rtObjects.RTChord 'i'>,
 <music21.romanText.rtObjects.RTRepeatStop ':||'>]
RTHandler.tokenizeBody(lines)

In the body, we may have measure, time signature, or note declarations, as well as possible other tagged definitions.

RTHandler.tokenizeHeader(lines)

In the header, we only have RTTagged tokens. We can this process these all as the same class.

RTKey

class music21.romanText.rtObjects.RTKey(src='', container=None)

An RTKey(RTAtom) defines both a change in KeySignature and a change in the analyzed Key.

They are defined by “;:” after the Key.

>>> gMinor = romanText.rtObjects.RTKey('g;:')
>>> gMinor
<music21.romanText.rtObjects.RTKey 'g;:'>
>>> gMinor.getKey()
<music21.key.Key of g minor>
>>> bMinor = romanText.rtObjects.RTKey('bb;:')
>>> bMinor
<music21.romanText.rtObjects.RTKey 'bb;:'>
>>> bMinor.getKey()
<music21.key.Key of b- minor>
>>> bMinor.getKeySignature()
<music21.key.KeySignature of 5 flats>
>>> eFlatMajor = romanText.rtObjects.RTKey('Eb;:')
>>> eFlatMajor
<music21.romanText.rtObjects.RTKey 'Eb;:'>
>>> eFlatMajor.getKey()
<music21.key.Key of E- major>

RTKey bases

RTKey read-only properties

Read-only properties inherited from ProtoM21Object:

RTKey methods

Methods inherited from RTKeyTypeAtom:

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTKeySignature

class music21.romanText.rtObjects.RTKeySignature(src='', container=None)

An RTKeySignature(RTAtom) only defines a change in the KeySignature. It does not in itself create a Key object, nor does it change the analysis taking place.

The number after KS defines the number of sharps (negative for flats).

>>> gMinor = romanText.rtObjects.RTKeySignature('KS-2')
>>> gMinor
<music21.romanText.rtObjects.RTKeySignature 'KS-2'>
>>> gMinor.getKeySignature()
<music21.key.KeySignature of 2 flats>
>>> aMajor = romanText.rtObjects.RTKeySignature('KS3')
>>> aMajor.getKeySignature()
<music21.key.KeySignature of 3 sharps>

RTKeySignature bases

RTKeySignature read-only properties

Read-only properties inherited from ProtoM21Object:

RTKeySignature methods

RTKeySignature.getKeySignature()

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTKeyTypeAtom

class music21.romanText.rtObjects.RTKeyTypeAtom(src='', container=None)

RTKeyTypeAtoms contain utility functions for all Key-type tokens, i.e. RTKey, RTAnalyticKey, but not KeySignature.

>>> gMinor = romanText.rtObjects.RTKeyTypeAtom('g;:')
>>> gMinor
<music21.romanText.rtObjects.RTKeyTypeAtom 'g;:'>
>>> gMinor.getKey()
<music21.key.Key of g minor>

RTKeyTypeAtom bases

RTKeyTypeAtom read-only properties

Read-only properties inherited from ProtoM21Object:

RTKeyTypeAtom methods

RTKeyTypeAtom.getKey()

This returns a Key, not a KeySignature object

RTKeyTypeAtom.getKeySignature()

Get a KeySignature object.

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTMeasure

class music21.romanText.rtObjects.RTMeasure(src='')

In RomanText, measures are given one per line and always start with ‘m’.

For instance:

m4 i b3 v b4 VI m5 b2 g: IV b4 V m6 i m7 D: V

Measure ranges can be used and copied, such as:

m8-m9=m4-m5

RTMeasure objects can also define variant readings for a measure:

m1 ii m1var1 ii b2 ii6 b3 IV

Variants are not part of the tag, but are read into an attribute.

Endings are indicated by a single letter after the measure number, such as “a” for first ending.

>>> rtm = romanText.rtObjects.RTMeasure('m15a V6 b1.5 V6/5 b2 I b3 viio6')
>>> rtm.data
'V6 b1.5 V6/5 b2 I b3 viio6'
>>> rtm.number
[15]
>>> rtm.repeatLetter
['a']
>>> rtm.isMeasure()
True

RTMeasure bases

RTMeasure read-only properties

Read-only properties inherited from ProtoM21Object:

RTMeasure methods

RTMeasure.getCopyTarget()

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

>>> rtm = romanText.rtObjects.RTMeasure('m35-36 = m29-30')
>>> rtm.number
[35, 36]
>>> rtm.getCopyTarget()
([29, 30], ['', ''])
>>> rtm = romanText.rtObjects.RTMeasure('m4 = m1')
>>> rtm.number
[4]
>>> rtm.getCopyTarget()
([1], [''])
RTMeasure.isMeasure()

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTNoChord

class music21.romanText.rtObjects.RTNoChord(src='', container=None)

An RTAtom subclass that defines absence of a chord. Also contains a reference to the container.

>>> chordNC = romanText.rtObjects.RTNoChord('NC')
>>> chordNC
<music21.romanText.rtObjects.RTNoChord 'NC'>
>>> rth = romanText.rtObjects.RTHandler()
>>> rth.tokenizeAtoms('nc NC N.C.')
[<music21.romanText.rtObjects.RTNoChord 'nc'>,
 <music21.romanText.rtObjects.RTNoChord 'NC'>,
 <music21.romanText.rtObjects.RTNoChord 'N.C.'>]

RTNoChord bases

RTNoChord read-only properties

Read-only properties inherited from ProtoM21Object:

RTNoChord methods

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTOpenParens

class music21.romanText.rtObjects.RTOpenParens(src='(', container=None)

A simple open parenthesis Atom with a sensible default

>>> romanText.rtObjects.RTOpenParens('(')
<music21.romanText.rtObjects.RTOpenParens '('>

RTOpenParens bases

RTOpenParens read-only properties

Read-only properties inherited from ProtoM21Object:

RTOpenParens methods

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTOptionalKeyClose

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

Marks the end of an optional Key area which does not affect the roman numeral analysis.

For example, it is possible to analyze in Bb major, while remaining in g minor.

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

RTOptionalKeyClose bases

RTOptionalKeyClose read-only properties

Read-only properties inherited from ProtoM21Object:

RTOptionalKeyClose methods

RTOptionalKeyClose.getKey()

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTOptionalKeyOpen

class music21.romanText.rtObjects.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)

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

RTOptionalKeyOpen bases

RTOptionalKeyOpen read-only properties

Read-only properties inherited from ProtoM21Object:

RTOptionalKeyOpen methods

RTOptionalKeyOpen.getKey()

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTPhraseBoundary

class music21.romanText.rtObjects.RTPhraseBoundary(src='||', container=None)
>>> phrase = romanText.rtObjects.RTPhraseBoundary('||')
>>> phrase
<music21.romanText.rtObjects.RTPhraseBoundary '||'>

RTPhraseBoundary bases

RTPhraseBoundary read-only properties

Read-only properties inherited from ProtoM21Object:

RTPhraseBoundary methods

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTPhraseMarker

class music21.romanText.rtObjects.RTPhraseMarker(src='', container=None)

A Phrase Marker:

>>> rtPhraseMarker = romanText.rtObjects.RTPhraseMarker('')
>>> rtPhraseMarker
<music21.romanText.rtObjects.RTPhraseMarker ''>

RTPhraseMarker bases

RTPhraseMarker read-only properties

Read-only properties inherited from ProtoM21Object:

RTPhraseMarker methods

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTRepeat

class music21.romanText.rtObjects.RTRepeat(src='', container=None)
>>> repeat = romanText.rtObjects.RTRepeat('||:')
>>> repeat
<music21.romanText.rtObjects.RTRepeat '||:'>

RTRepeat bases

RTRepeat read-only properties

Read-only properties inherited from ProtoM21Object:

RTRepeat methods

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTRepeatStart

class music21.romanText.rtObjects.RTRepeatStart(src='||:', container=None)
>>> repeat = romanText.rtObjects.RTRepeatStart()
>>> repeat
<music21.romanText.rtObjects.RTRepeatStart ...'||:'>

RTRepeatStart bases

RTRepeatStart read-only properties

Read-only properties inherited from ProtoM21Object:

RTRepeatStart methods

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTRepeatStop

class music21.romanText.rtObjects.RTRepeatStop(src=':||', container=None)
>>> repeat = romanText.rtObjects.RTRepeatStop()
>>> repeat
<music21.romanText.rtObjects.RTRepeatStop ...':||'>

RTRepeatStop bases

RTRepeatStop read-only properties

Read-only properties inherited from ProtoM21Object:

RTRepeatStop methods

Methods inherited from RTAtom:

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTTagged

class music21.romanText.rtObjects.RTTagged(src='')

In romanText, some data elements are tags, that is a tag name, a colon, optional whitespace, and data. In non-RTTagged elements, there is just data.

All tagged tokens are subclasses of this class. Examples are:

Title: Die Jahrzeiten Composer: Fanny Mendelssohn

>>> rtTag = romanText.rtObjects.RTTagged('Title: Die Jahrzeiten')
>>> rtTag.tag
'Title'
>>> rtTag.data
'Die Jahrzeiten'
>>> rtTag.isTitle()
True
>>> rtTag.isComposer()
False

RTTagged bases

RTTagged read-only properties

Read-only properties inherited from ProtoM21Object:

RTTagged methods

RTTagged.isAnalyst()

True if tag represents an analyst, otherwise False.

>>> tag = romanText.rtObjects.RTTagged('Analyst: This is an analyst.')
>>> tag.isAnalyst()
True
>>> tag = romanText.rtObjects.RTTagged('Nothing: Nothing at all.')
>>> tag.isAnalyst()
False
RTTagged.isComposer()

True is the tag represents a composer.

>>> rth = romanText.rtObjects.RTTagged('Composer: Claudio Monteverdi')
>>> rth.isComposer()
True
>>> rth.isTitle()
False
>>> rth.isWork()
False
>>> rth.data
'Claudio Monteverdi'
RTTagged.isForm()

True if tag represents a form, otherwise False.

>>> tag = romanText.rtObjects.RTTagged('Form: This is a form.')
>>> tag.isForm()
True
>>> tag = romanText.rtObjects.RTTagged('Nothing: Nothing at all.')
>>> tag.isForm()
False
RTTagged.isKeySignature()

True if tag represents a key signature, otherwise False.

>>> tag = romanText.rtObjects.RTTagged('KeySignature: This is a key signature.')
>>> tag.isKeySignature()
True
>>> tag.data
'This is a key signature.'

KeySignatures are a type of tagged data found outside of measures, such as “Key Signature: -1” meaning one flat.

Key signatures are generally numbers representing the number of sharps (or negative for flats). Non-standard key signatures are not supported.

>>> tag = romanText.rtObjects.RTTagged('KeySignature: -3')
>>> tag.data
'-3'

music21 supports one legacy key signature type: KeySignature: Bb which represents a one-flat signature. Important to note: no other key signatures of this type are supported. (For instance, KeySignature: Ab has no effect)

>>> tag = romanText.rtObjects.RTTagged('KeySignature: Bb')
>>> tag.data
'Bb'

Testing that .isKeySignature returns False for non-key signatures:

>>> tag = romanText.rtObjects.RTTagged('Nothing: Nothing at all.')
>>> tag.isKeySignature()
False

N.B.: this is not the same as a key definition found inside a Measure. These are represented by RTKey rtObjects, defined below, and are not RTTagged rtObjects, but RTAtom subclasses.

RTTagged.isMovement()

True if tag represents a movement, otherwise False.

>>> tag = romanText.rtObjects.RTTagged('Movement: This is a movement.')
>>> tag.isMovement()
True
>>> tag = romanText.rtObjects.RTTagged('Nothing: Nothing at all.')
>>> tag.isMovement()
False
RTTagged.isNote()

True if tag represents a note, otherwise False.

>>> tag = romanText.rtObjects.RTTagged('Note: This is a note.')
>>> tag.isNote()
True
>>> tag = romanText.rtObjects.RTTagged('Nothing: Nothing at all.')
>>> tag.isNote()
False
RTTagged.isPedal()

True if tag represents a pedal, otherwise False.

>>> tag = romanText.rtObjects.RTTagged('Pedal: This is a pedal.')
>>> tag.isPedal()
True
>>> tag = romanText.rtObjects.RTTagged('Nothing: Nothing at all.')
>>> tag.isPedal()
False
RTTagged.isPiece()

True if tag represents a piece, otherwise False.

>>> tag = romanText.rtObjects.RTTagged('Piece: This is a piece.')
>>> tag.isPiece()
True
>>> tag = romanText.rtObjects.RTTagged('Nothing: Nothing at all.')
>>> tag.isPiece()
False
RTTagged.isProofreader()

True if tag represents a proofreader, otherwise False.

>>> tag = romanText.rtObjects.RTTagged('Proofreader: This is a proofreader.')
>>> tag.isProofreader()
True
>>> tag = romanText.rtObjects.RTTagged('Nothing: Nothing at all.')
>>> tag.isProofreader()
False
RTTagged.isSeventhMinor()

True if tag represents a configuration setting for setting vii/viio/VII in minor

>>> tag = romanText.rtObjects.RTTagged('Seventh Minor: Courtesy')
>>> tag.isSeventhMinor()
True
>>> tag.data
'Courtesy'
RTTagged.isSixthMinor()

True if tag represents a configuration setting for setting vi/vio/VI in minor

>>> tag = romanText.rtObjects.RTTagged('Sixth Minor: Flat')
>>> tag.isSixthMinor()
True
>>> tag.data
'Flat'
RTTagged.isTimeSignature()

True if tag represents a time signature, otherwise False.

>>> tag = romanText.rtObjects.RTTagged('TimeSignature: This is a time signature.')
>>> tag.isTimeSignature()
True
>>> tag = romanText.rtObjects.RTTagged('Nothing: Nothing at all.')
>>> tag.isTimeSignature()
False

TimeSignature header data can be found intermingled with measures.

RTTagged.isTitle()

True if tag represents a title, otherwise False.

>>> tag = romanText.rtObjects.RTTagged('Title: This is a title.')
>>> tag.isTitle()
True
>>> tag = romanText.rtObjects.RTTagged('Nothing: Nothing at all.')
>>> tag.isTitle()
False
RTTagged.isVersion()

True if tag defines the version of RomanText standard used, otherwise False.

Pieces without the tag are defined to conform to RomanText 1.0, the version described in the ISMIR publication.

>>> rth = romanText.rtObjects.RTTagged('RTVersion: 1.0')
>>> rth.isTitle()
False
>>> rth.isVersion()
True
>>> rth.tag
'RTVersion'
>>> rth.data
'1.0'
RTTagged.isWork()

True if tag represents a work, otherwise False.

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.

>>> rth = romanText.rtObjects.RTTagged('Work: BWV232')
>>> rth.isWork()
True
>>> rth.tag
'Work'
>>> rth.data
'BWV232'

For historical reasons, the tag ‘Madrigal’ also designates a work.

>>> rth = romanText.rtObjects.RTTagged('Madrigal: 4.12')
>>> rth.isTitle()
False
>>> rth.isWork()
True
>>> rth.tag
'Madrigal'
>>> rth.data
'4.12'

Methods inherited from RTToken:

Methods inherited from ProtoM21Object:

RTToken

class music21.romanText.rtObjects.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.

>>> rtt = romanText.rtObjects.RTToken('||:')
>>> rtt
<music21.romanText.rtObjects.RTToken '||:'>

A standard RTToken returns False for all the following.

>>> rtt.isComposer() or rtt.isTitle() or rtt.isPiece()
False
>>> rtt.isAnalyst() or rtt.isProofreader()
False
>>> rtt.isTimeSignature() or rtt.isKeySignature() or rtt.isNote()
False
>>> rtt.isForm() or rtt.isPedal() or rtt.isMeasure() or rtt.isWork()
False
>>> rtt.isMovement() or rtt.isVersion() or rtt.isAtom()
False

RTToken bases

RTToken read-only properties

Read-only properties inherited from ProtoM21Object:

RTToken methods

RTToken.isAnalyst()
RTToken.isAtom()

Atoms are any untagged data; generally only found inside a measure definition.

RTToken.isComposer()
RTToken.isForm()

Occasionally found in header.

RTToken.isKeySignature()
RTToken.isMeasure()
RTToken.isMovement()
RTToken.isNote()
RTToken.isPedal()
RTToken.isPiece()
RTToken.isProofreader()
RTToken.isTimeSignature()
RTToken.isTitle()
RTToken.isVersion()
RTToken.isWork()

Methods inherited from ProtoM21Object: