polyrhythm

Crates.iopolyrhythm
lib.rspolyrhythm
version0.1.1
sourcesrc
created_at2022-04-09 18:18:57.708831
updated_at2022-04-09 18:27:43.61185
descriptionUtilities for generating polyrhythms.
homepagehttps://github.com/bring-shrubbery/polyrhythm
repositoryhttps://github.com/bring-shrubbery/polyrhythm
max_upload_size
id564831
size21,368
Antoni Silvestrovič (bring-shrubbery)

documentation

https://github.com/bring-shrubbery/polyrhythm/tree/main/polyrhythm-rust

README

Polyrhythm

Generate polyrhythms in Rust.

Usage

fn get_polyrhythm(beats: &Vec<usize>) -> Option<Vec<Vec<usize>>>

  • Input: Accepts a vector of number of beats for each track.
  • Output: Returns a vector of same-length vectors, that contain either 1 or 0 indicating beat or no beat respectively. The number of the nested vectors is determined by a least common multiple of the beats in each track.

Example usage:

let beats = vec![2, 3];
let result = get_polyrhythm(&beats);

// result:
// vec![
//   vec![1, 0, 0, 1, 0, 0],
//   vec![1, 0, 1, 0, 1, 0]
// ]

License

Mozilla Public License 2.0

Commit count: 22

cargo fmt