Skip to main content

Segment

Struct Segment 

Source
pub struct Segment {
    pub rules: Rules,
    /* private fields */
}
Expand description

A bass note, its figures, and the voicings they allow.

Fields§

§rules: Rules

The rules its voicings are held to.

Implementations§

Source§

impl Segment

Source

pub fn new( bass: Pitch, quarter_length: FloatType, notation: &Notation, scale: &FiguredBassScale, rules: Rules, num_parts: usize, max_pitch: Pitch, ) -> Result<Self>

The segment of bass under notation, read in scale, voiced in num_parts parts no higher than max_pitch: music21’s Segment.

§Errors

A bass or figures the scale cannot read, or a maximum pitch with no octave.

Source

pub fn from_pitch_names( bass: Pitch, quarter_length: FloatType, pitch_names: Vec<String>, rules: Rules, num_parts: usize, max_pitch: Pitch, ) -> Result<Self>

The segment of bass spelling the notes named pitch_names, as music21 builds one given listOfPitches rather than figures.

§Errors

A pitch name that is none, or a maximum pitch with no octave.

Source

pub fn overlaid(self) -> Self

The same segment, with the parts its rules hold to a pitch sung at that pitch in every voicing: music21’s OverlaidSegment.

Source

pub fn bass(&self) -> &Pitch

The bass.

Source

pub fn quarter_length(&self) -> FloatType

How long the bass lasts, in quarter notes.

Source

pub fn num_parts(&self) -> usize

How many parts sing it, the bass among them.

Source

pub fn max_pitch(&self) -> &Pitch

The highest pitch any part may sing.

Source

pub fn pitch_names(&self) -> &[String]

The names of the notes the bass and figures stand for, the bass’s first: music21’s pitchNamesInChord.

Source

pub fn pitches_above_bass(&self) -> &[Pitch]

Every pitch from the bass up to the highest allowed that spells one of those notes, lowest first: music21’s allPitchesAboveBass.

Source

pub fn chord(&self) -> &Chord

Those pitches as one chord: music21’s segmentChord.

Source

pub fn all_single_possibilities(&self) -> Result<Vec<Possibility>>

Every voicing, acceptable or not, in music21’s order: the highest part changes slowest. music21’s allSinglePossibilities.

Source

pub fn all_correct_single_possibilities(&self) -> Result<Vec<Possibility>>

The voicings its rules accept: music21’s allCorrectSinglePossibilities.

The voicings are walked as indices into what each part may sing, and held to the rules over each pitch’s place and name worked out once, so only the voicings kept are ever built: a seventh chord has thousands to look at and a handful to keep.

Source

pub fn all_correct_consecutive_possibilities( &self, next: &mut Segment, ) -> Result<Consecutive>

Every pair of voicings next may follow this segment by, resolving this chord by its own rule where the rules say to and it is a chord with one: music21’s allCorrectConsecutivePossibilities.

next is taken mutably because music21 lets a dominant seventh resolving to its tonic leave that tonic incomplete, which it does by switching the tonic segment’s rule off.

§Errors

Two segments of different numbers of parts or different highest pitches, or a resolution that fails.

Source

pub fn resolve_dominant_seventh_segment( &self, next: &mut Segment, ) -> Result<Consecutive>

Resolves a dominant seventh to next: to the tonic, major or minor, and from root position also to either submediant or subdominant. music21’s resolveDominantSeventhSegment.

§Errors

A segment whose chord is no dominant seventh.

Source

pub fn resolve_diminished_seventh_segment( &self, next: &Segment, doubled_root: bool, ) -> Result<Consecutive>

Resolves a diminished seventh to next: to the tonic, major or minor, or to the subdominant. With doubled_root, a resolution to the tonic doubles its root, unless the inversions decide it. music21’s resolveDiminishedSeventhSegment.

§Errors

A segment whose chord is no fully diminished seventh.

Source

pub fn resolve_augmented_sixth_segment( &self, next: &Segment, ) -> Result<Consecutive>

Resolves an augmented sixth to next: to the tonic in second inversion, major or minor, or to the dominant. An Italian sixth, and a kind music21 has no rule for, resolve as any chord does. music21’s resolveAugmentedSixthSegment.

§Errors

A segment whose chord is no augmented sixth.

Trait Implementations§

Source§

impl Clone for Segment

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 Segment

Source§

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

Formats the value using the given formatter. Read more

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> 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.