1 unstable release
0.1.0 | Mar 20, 2024 |
---|
#90 in Multimedia
43KB
1K
SLoC
Simplee > Musika
Description
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}");
Build and Run
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
Sharps and Flats
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]");
Chords
The crate allows you to build the following chords:
You can find all the chords in the chords folder.
Scales
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.
Piano Exercises
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 |
Resources
- Piano Chords
- 5 Jazz Chords that Actually Sound Great
- The 12 major scales Formula & Pattern
- The 12 minor scales Formula & Pattern
About
Code designed and written on the beautiful island of Saaremaa, Estonia.
Dependencies
~10KB