pub struct Realization { /* private fields */ }Expand description
Every way of voicing a figured bass line: music21’s Realization.
Implementations§
Source§impl Realization
impl Realization
Sourcepub fn of(segments: Vec<Segment>) -> Result<Self>
pub fn of(segments: Vec<Segment>) -> Result<Self>
The realization of segments, a line’s segments in order. Written
out, it is in C major and common time, each segment’s bass lasting
as long as the segment; a realization made by
FiguredBassLine::realize is written as its line is.
§Errors
No segments, or a resolution that fails.
Sourcepub fn fallbacks(&self) -> &[String]
pub fn fallbacks(&self) -> &[String]
What each chord that found no resolution of its own warned, in order.
Sourcepub fn num_solutions(&self) -> usize
pub fn num_solutions(&self) -> usize
How many ways there are of voicing the whole line: music21’s
getNumSolutions.
Sourcepub fn all_possibility_progressions(&self) -> Vec<Vec<Possibility>>
pub fn all_possibility_progressions(&self) -> Vec<Vec<Possibility>>
Every way of voicing the whole line, a voicing for each bass note:
music21’s getAllPossibilityProgressions, in its order.
Sourcepub fn possibility_progression_by(
&self,
choose: impl FnMut(usize) -> usize,
) -> Result<Vec<Possibility>>
pub fn possibility_progression_by( &self, choose: impl FnMut(usize) -> usize, ) -> Result<Vec<Possibility>>
One way of voicing the whole line, each voicing chosen by choose,
which is given how many there are to choose from and answers the
index of one: music21’s getRandomPossibilityProgression, with the
choosing left to the caller.
§Errors
A line with no way of voicing it, or a choice out of range.
Sourcepub fn keyboard_style_output(&self) -> bool
pub fn keyboard_style_output(&self) -> bool
Whether realizations are written in keyboard style, the upper parts
as chords on one staff over the bass, as they are to begin with, or
in chorale style with a staff for each part: music21’s
keyboardStyleOutput.
Sourcepub fn set_keyboard_style_output(&mut self, keyboard_style: bool)
pub fn set_keyboard_style_output(&mut self, keyboard_style: bool)
Says whether realizations are written in keyboard style or in chorale style.
Sourcepub fn generate_realization_from_possibility_progression(
&self,
progression: &[Possibility],
) -> Result<Stream>
pub fn generate_realization_from_possibility_progression( &self, progression: &[Possibility], ) -> Result<Stream>
One way of voicing the line written out as a score, a voicing for
each segment: music21’s generateRealizationFromPossibilityProgression.
In keyboard style the score is two parts, the upper parts of each voicing as a chord under a treble clef and the bass under a bass clef; in chorale style each part has a staff of its own, under the clef that fits it best. Every part opens with the key signature and the meter of the line, is cut into measures, and has the notes that run past a barline tied, its tuplets bracketed and its notes beamed.
use music21_rs::Pitch;
use music21_rs::figuredbass::realizer::FiguredBassLine;
use music21_rs::figuredbass::rules::Rules;
let mut line = FiguredBassLine::default();
line.add_element(Pitch::from_name("C3")?, 2.0, None);
line.add_element(Pitch::from_name("G2")?, 2.0, Some("7"));
line.add_element(Pitch::from_name("C3")?, 4.0, None);
let realization = line.realize(&Rules::default(), 4, &Pitch::from_name("B5")?)?;
let voicings = realization.all_possibility_progressions();
let score = realization.generate_realization_from_possibility_progression(&voicings[0])?;
assert_eq!(score.parts().len(), 2);
assert_eq!(score.parts()[0].measures().len(), 2);§Errors
A progression with fewer voicings than the line has segments, or a voicing that is no chord.
Sourcepub fn generate_all_realizations(&self) -> Result<Stream>
pub fn generate_all_realizations(&self) -> Result<Stream>
Every way of voicing the line written out one after another in one
score: music21’s generateAllRealizations. Each realization keeps
its own measure numbers and its closing barline.
§Errors
A line with no way of voicing it, or a realization that cannot be written.
Sourcepub fn generate_random_realization(
&self,
choose: impl FnMut(usize) -> usize,
) -> Result<Stream>
pub fn generate_random_realization( &self, choose: impl FnMut(usize) -> usize, ) -> Result<Stream>
One way of voicing the line written out as a score, each voicing
chosen by choose, which is given how many there are to choose from
and answers the index of one: music21’s generateRandomRealization,
with the choosing left to the caller.
§Errors
A line with no way of voicing it, or a choice out of range.
Sourcepub fn generate_random_realizations(
&self,
amount: usize,
choose: impl FnMut(usize) -> usize,
) -> Result<Stream>
pub fn generate_random_realizations( &self, amount: usize, choose: impl FnMut(usize) -> usize, ) -> Result<Stream>
So many ways of voicing the line, each chosen by choose, written
out one after another in one score: music21’s
generateRandomRealizations. Asked for more than there are, it
answers every one of them in order, as generate_all_realizations
does. One way may be chosen more than once.
§Errors
A line with no way of voicing it, or a choice out of range.
Trait Implementations§
Source§impl Clone for Realization
impl Clone for Realization
Auto Trait Implementations§
impl Freeze for Realization
impl RefUnwindSafe for Realization
impl Send for Realization
impl Sync for Realization
impl Unpin for Realization
impl UnsafeUnpin for Realization
impl UnwindSafe for Realization
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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