Skip to main content

TabChord

Struct TabChord 

Source
pub struct TabChord {
Show 17 fields pub version: Version, pub chord: String, pub numeral: String, pub relativeroot: Option<String>, pub form: Option<String>, pub figbass: Option<String>, pub changes: Option<String>, pub phraseend: Option<String>, pub pedal: Option<String>, pub local_key: String, pub global_key: String, pub beat: FloatType, pub measure: i32, pub timesig: String, pub volta: Option<String>, pub length: Option<FloatType>, pub extra: Vec<(String, String)>,
}
Expand description

One row of a DCML table, read: music21’s TabChord and TabChordV2.

The columns of the two standards differ in their names and in what they carry, and a row of either is read into this one type – what the lab’s version 1 calls measure and beat its version 2 calls mn and mn_onset, and counts the onset in whole notes rather than in beats. Every column the standard does not name is kept beside the row, as music21 keeps its extra.

Fields§

§version: Version

Which standard the row was read in.

§chord: String

The label the annotator wrote: the lab’s chord.

§numeral: String

The degree alone.

§relativeroot: Option<String>

The degree the chord is read in, written after a slash.

§form: Option<String>

o, +, % or M: how the chord is built over the degree.

§figbass: Option<String>

The figured bass under it.

§changes: Option<String>

The tones it adds or leaves out.

§phraseend: Option<String>

Whether a phrase ends here.

§pedal: Option<String>

The note held under it.

§local_key: String

The key in force, as a degree of the global key or as a key.

§global_key: String

The key the piece is in.

§beat: FloatType

The beat of the measure the chord falls on, counted from one.

§measure: i32

The measure it falls in.

§timesig: String

The meter in force, as a ratio.

§volta: Option<String>

Which time through a repeat the row belongs to, where the lab’s version 2 says.

§length: Option<FloatType>

How long the chord sounds, where the lab’s version 1 says.

§extra: Vec<(String, String)>

Every other column of the row, by name.

Implementations§

Source§

impl TabChord

Source

pub fn from_row( header: &[String], row: &[String], version: Version, ) -> Result<Self>

A row read against a table’s own header: music21’s populateFromRow, which reads the columns its standard names and keeps the rest beside them.

Source

pub fn key(&self) -> Result<Key>

The key the chord is read in: the local key as a key of its own, where the table wrote it as a degree of the global key.

§Errors

A local key that names no major or minor triad of the global one.

Source

pub fn element(&self) -> Result<StreamElement>

The chord the row stands for: a numeral in the key in force, or the chord of no harmony the lab writes @none.

The sixth and the seventh of a minor key are read flat, as music21 reads a table’s.

§Errors

A label or a key the crate cannot read.

Trait Implementations§

Source§

impl Clone for TabChord

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TabChord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TabChord

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TabChord

Available on crate feature serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for TabChord

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for TabChord

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TabChord

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.