[−][src]Function atm::utils::gen_sequences
pub fn gen_sequences(
notes: &MIDINoteVec,
length: u32
) -> MultiProduct<Iter<MIDINote>>
Generate melodies of length length
containing the
notes in provided note set notes
. In other words,
generate the cartesion product of notes
with itself
length
times.
Arguments:
notes
: set of MIDI notes (see: libatm::MIDINote)length
: length of sequences to generate
Examples
// Create MIDI note set let note_set = "C:4,C:4,D:4,E:4,F:4,G:5".parse::<libatm::MIDINoteVec>().unwrap(); // Create iterable over all possible melodies, which in this example would be // 6 ^ 8 = 1,679,616 instances of `Vec<&libatm::MIDINote>`. let melodies = atm::utils::gen_sequences(¬e_set, 8); assert_eq!(1679616usize, melodies.count())