Skip to main content

ToneRow

Struct ToneRow 

Source
pub struct ToneRow { /* private fields */ }
Expand description

An ordered sequence of pitch classes.

Implementations§

Source§

impl ToneRow

Source

pub fn new(pitch_classes: impl IntoIterator<Item = IntegerType>) -> Self

Builds a row from pitch-class integers, which are reduced modulo 12 the way music21’s pcToToneRow does, so [-6, 19, 128] is [6, 7, 8].

Source

pub fn from_pitches<'a>(pitches: impl IntoIterator<Item = &'a Pitch>) -> Self

Builds a row from the pitch classes of a sequence of pitches.

Source

pub fn pitch_classes(&self) -> &[u8]

The pitch classes in order.

Source

pub fn len(&self) -> usize

The number of pitch classes in the row.

Source

pub fn is_empty(&self) -> bool

Whether the row has no pitch classes.

Source

pub fn pitches(&self) -> Vec<Pitch>

The row as octave-less pitches, spelled the way music21 spells a pitch built from a pitch class (C#, E-, F#, G#, B-).

Source

pub fn note_names(&self) -> Vec<String>

The note names of the row, music21’s noteNames.

Source

pub fn is_twelve_tone_row(&self) -> bool

Whether the row is a permutation of all twelve pitch classes.

Source

pub fn make_twelve_tone_row(&self) -> Result<ToneRow>

The row as a twelve-tone row: music21’s makeTwelveToneRow. There is one row type here, so this is the row itself, and a row that is not a permutation of the twelve pitch classes is an error rather than a row whose twelve-tone questions fail one by one.

Source

pub fn is_same_row(&self, other: &ToneRow) -> bool

Whether two rows have the same pitch classes in the same order.

Source

pub fn intervals_as_string(&self) -> String

The intervals between consecutive pitch classes as one character each, with T for ten and E for eleven: music21’s getIntervalsAsString.

Source

pub fn zero_centered_transformation( &self, transformation: Transformation, index: IntegerType, ) -> ToneRow

Transforms the row in the zero-centered convention, where P(n) and I(n) start on pitch class n and R(n) and RI(n) end on it.

Source

pub fn original_centered_transformation( &self, transformation: Transformation, index: IntegerType, ) -> ToneRow

Transforms the row in the original-centered convention, where T(n) transposes the row up n semitones and the other transformations act in place before transposing by n.

Source

pub fn transformation( &self, convention: TransformationConvention, transformation: Transformation, index: IntegerType, ) -> ToneRow

Transforms the row under either convention.

Source

pub fn find_zero_centered_transformations( &self, other: &ToneRow, ) -> Vec<IndexedTransformation>

The zero-centered transformations that take this row to other, in music21’s order P, I, R, RI.

Source

pub fn find_original_centered_transformations( &self, other: &ToneRow, ) -> Vec<IndexedTransformation>

The original-centered transformations that take this row to other, in music21’s order T, I, R, RI.

Source

pub fn find_transformations( &self, convention: TransformationConvention, other: &ToneRow, ) -> Vec<IndexedTransformation>

The transformations that take this row to other under either convention.

Source

pub fn matrix(&self) -> TwelveToneMatrix

The row’s matrix: every transposition of the row, ordered so that the leading diagonal is zero and each column reads the inversion.

Source

pub fn find_historical(&self) -> Vec<&'static HistoricalRow>

The historical rows identical to this one.

Source

pub fn find_transformed_historical( &self, convention: TransformationConvention, ) -> Vec<(&'static HistoricalRow, Vec<IndexedTransformation>)>

The historical rows of which this row is a transformation, each with the transformations taking the historical row to this one.

Source

pub fn is_all_interval(&self) -> Result<bool>

Whether every interval class from one to eleven occurs between consecutive members of the row.

Errors unless the row is a twelve-tone row.

The Link chord classification of the row, if it is one: an all-interval row containing a voicing of the all-trichord hexachord [0, 1, 2, 4, 7, 8], numbered as in John Link’s catalogue.

Errors unless the row is a twelve-tone row.

Whether the row is a Link chord. Errors unless it is a twelve-tone row.

Source

pub fn are_combinatorial( &self, first: Transformation, first_index: IntegerType, second: Transformation, second_index: IntegerType, ) -> Result<bool>

Whether two zero-centered transformations of the row are hexachordally combinatorial: their first hexachords together form the aggregate.

Errors unless the row is a twelve-tone row.

Trait Implementations§

Source§

impl Clone for ToneRow

Source§

fn clone(&self) -> ToneRow

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 ToneRow

Source§

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

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

impl Default for ToneRow

Source§

fn default() -> ToneRow

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

impl<'de> Deserialize<'de> for ToneRow

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 Display for ToneRow

Source§

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

The pitch classes as single characters, A and B for ten and eleven.

Source§

impl Eq for ToneRow

Source§

impl From<Vec<u8>> for ToneRow

Source§

fn from(pitch_classes: Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<[u8; N]> for ToneRow

Source§

fn from(pitch_classes: [u8; N]) -> Self

Converts to this type from the input type.
Source§

impl Hash for ToneRow

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Index<usize> for ToneRow

Source§

type Output = u8

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a> IntoIterator for &'a ToneRow

Source§

type Item = &'a u8

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, u8>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for ToneRow

Source§

fn eq(&self, other: &ToneRow) -> 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 ToneRow

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 ToneRow

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.