A Rust crate for musical basic elements.
use musika_rs::{C, chords::{self}, scales::{self}};
let chord = C.maj();
println!("{chord:X}");
let scale = scales::major(C);
println!("{scale:X}");
To build the crate
cargo build
To build and view the internal documentstion:
cargo doc --open
You can find more examples in the examples folder. To run an example:
cargo run --example find
The crate allows you to print the notes either with sharps (#) or flats(b) by using X or x when fomating the chords or the scales:
let scale = minor(C);
assert_eq!(format!("{scale:X}"), "C minor [C, D, D#, F, G, G#, A#, C]");
assert_eq!(format!("{scale:x}"), "C minor [C, D, Eb, F, G, Ab, Bb, C]");
The crate allows you to build the following chords:
You can find all the chords in the chords folder.
The crate allows you to build the following scales:
use musika_rs::scales::*;
let scale = scales::major(C);
assert_eq!(format!("{scale:X}"), "C major [C, D, E, F, G, A, B, C]");
assert_eq!(format!("{scale:x}"), "C major [C, D, E, F, G, A, B, C]");
You can find all the scales in the scales folder.
You can find all piano exercises implemented in the exercises examples. You can see the practices by running:
cargo run --example exercise1
cargo run --example exercise2
cargo run --example exercise3
cargo run --example exercise4
cargo run --example exercise5
- Exercise 1 | C - Am | F - G |
- Exercise 2 | C - G | Am - F | C - G | F - Em - Dm - C |
- Exercise 3 | Cx4 | Gx4 | Gx4 | Cx4 | Fx4 | Cx4 | Gx4 | Cx4 |
- Exercise 4 | C | F | Bdim | Em | Am | Dm | G | C |
- Exercise 5 | Dm9 Dm9 | G13 G13 | Dm9 Dm9 | G13 G13 |
- Piano Chords
- 5 Jazz Chords that Actually Sound Great
- The 12 major scales Formula & Pattern
- The 12 minor scales Formula & Pattern
Code designed and written on the beautiful island of Saaremaa, Estonia.