[][src]Function atm::utils::gen_num_melodies

pub fn gen_num_melodies(num_notes: u32, melody_length: u32) -> u64

Calculate total melodies given number of distinct notes and desired length of melodies

Arguments

Examples

// Create MIDI note set with 6 notes
let note_set = "C:4,C:7,D:4,E:4,F:4,G:5".parse::<libatm::MIDINoteSet>().unwrap();
// Calculate total number of melodies of length 9 with these 6 notes
let num_melodies = atm::utils::gen_num_melodies(note_set.len() as u32, 9);
// 6 ^ 9 is 10,077,696
assert_eq!(10077696, num_melodies);