ChordSymbol class
Internal representation of a MusicXML chord symbol
- Root: a string representing the chord root pitch class, e.g. "C#". Use rootTypeSafe to get a detailed representation of root.
- Kind: a string representing the chord kind, e.g. "m7" for minor-seventh, "9" for dominant-ninth, or the empty string for major triad. Use kindTypeSafe to get a type save representation of kind.
- Scale degree modifications: a list of strings representing scale degree modifications for the chord, e.g. "add9" to add an unaltered ninth scale degree (without the seventh), "b5" to flatten the fifth scale degree, "no3" to remove the third scale degree, etc. Use degreesTypeSafe to get a type safe representation of root.
- Bass: a string representing the chord bass pitch class, or None if the bass
pitch class is the same as the root pitch class.
Use bassTypeSafe to get a type safe representation of bass.
There's also a special chord kind "N.C." representing no harmony, for which
all other fields should be None.
Use the
get_figure_string
method to get a string representation of the chord symbol as might appear in a lead sheet. This string representation is what we use to represent chord symbols in NoteSequence protos, as text annotations. While the MusicXML representation has more structure, using an unstructured string provides more flexibility and allows us to ingest chords from other sources, e.g. guitar tabs on the web.
Constructors
-
ChordSymbol({required double timePosition, required String root, required Root rootTypeSafe, required String kind, required Kind kindTypeSafe, required List<
String> degrees, required List<Degree> degreesTypeSafe, String? bass, Bass? bassTypeSafe}) -
const
- ChordSymbol.parse(XmlElement xmlHarmony, MusicXMLParserState state)
-
factory
Properties
- bass → String?
-
final
- bassTypeSafe → Bass?
-
final
-
degrees
→ List<
String> -
final
-
degreesTypeSafe
→ List<
Degree> -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- kind → String
-
final
- kindTypeSafe → Kind
-
final
- root → String
-
final
- rootTypeSafe → Root
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timePosition → double
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- noChord → ChordSymbol
-
no setter
Static Methods
-
alterToString(
String alterText) → String - Parse alter text to a string of one or two sharps/flats.
-
parseBass(
XmlElement xmlBass, MusicXMLParserState state) → String - Parse the
-
parseDegree(
XmlElement xmlDegree) → String - Parse and return the
-
parsePitch(
XmlElement xmlPitch, String stepTag, String alterTag, MusicXMLParserState state) → String - Parse and return the pitch-like
-
parseRoot(
XmlElement child, MusicXMLParserState state) → String - Parse the