Expand description
music21’s IntervalNetwork: a scale or a chord as a graph whose nodes
are pitches not yet realized and whose edges are intervals.
A network has two ends, its low and high termini, which are the same pitch class an octave or more apart; walking off one end comes back in at the other, so a scale can be realized over any range. Edges are walked ascending, descending or both ways, which is how a melodic minor goes up by one set of steps and down by another. Where two edges leave a node the same way, the node weights choose between them, from a draw the caller supplies: nothing here reaches for a random number generator of its own.
use music21::Pitch;
use music21::scale::intervalnetwork::{IntervalNetwork, PitchRange};
let major = IntervalNetwork::bidirected(&["M2", "M2", "m2", "M2", "M2", "M2", "m2"])?;
let realized = major.realize_pitches(&Pitch::from_name("G4")?, None, &PitchRange::default())?;
let names: Vec<String> = realized.iter().map(Pitch::name_with_octave).collect();
assert_eq!(names, ["G4", "A4", "B4", "C5", "D5", "E5", "F#5", "G5"]);Structs§
- Descending
Walk - How a descending realization is walked.
- Edge
- An interval between two nodes, and the way it is walked: music21’s
Edge. - Edge
Spec - An edge of
IntervalNetwork::fill_arbitrary: its step and the nodes it connects, each pair with the way it is walked. - Found
- A tonic
IntervalNetwork::findtried, and how many pitches it found. - Interval
Network - A scale or chord as a graph of intervals: music21’s
IntervalNetwork. - Matched
- Which of a list of pitches a realization holds and which it does not, each as an index into the list.
- Node
- A pitch the network does not hold yet: music21’s
Node. - Pitch
Range - The range a realization keeps; either bound may be open.
- Realized
- A realization: its pitches, and the node each stands on.
Enums§
- Direction
- The way an edge is walked: music21’s
Direction. - Fill
- Whether a realization starting at the low terminus first works out a range when none is given.
- First
- Whether a descending walk keeps the pitch it starts from.
- Moduli
- Whether a degree past either end is folded back into the network.
- Neighbor
- Which node
next_pitchstarts from when the pitch it is given is on none: music21’sgetNeighbor. - NodeId
- Which node an edge connects: a terminus, or a node between them, numbered as it was added.
- Node
Name - How a node is named when asking for it: by scale degree, or as itself.
- Octaves
- Whether a network’s pitches repeat at the octave, which lets a walk start an octave from where it was asked to.
- Order
- The order a realization comes back in.
- Pathways
- Whether every walk through a network takes the same way.
- Termini
- Whether the two termini count as one degree.
- Terminus
- Either end of a network: music21’s
Terminus.
Functions§
- close_
on_ tonic - The steps with the last one respelled so that they climb from C4 to
exactly C5: music21’s
_closeOnTonic. Steps that already do are returned as they are, and so are steps spanning anything but an octave. - cyclical
- music21’s
AbstractCyclicalScalenetwork: the steps walked both ways. Whole semitones adding up to a divisor of the octave repeat to fill it, closed on the tonic, and the network then repeats at the octave. - octave_
repeating - music21’s
AbstractOctaveRepeatingScalesteps and network: the steps completed to an octave by the interval left over, or respelled to close on the tonic where they already span twelve semitones. Steps past the octave make a network that does not repeat at it. - pitch_
bounds - The indices of the lowest and highest of
pitches, the earlier of two equal lows and the later of two equal highs: music21’sfilterPitchList, which sorts on pitch space and then on index. - weighted_
hexatonic_ blues - music21’s
AbstractWeightedHexatonicBlues: the minor pentatonic with the blue note between its fourth and fifth degrees as a second way from F to G, which a weighted walk takes or passes by.
Type Aliases§
- Draw
- A source of draws from
0.0(inclusive) to1.0(exclusive), used to choose between branches by weight.