-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
477e7fc
commit b242f7c
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use musika_rs::{Bar, A, B, C, D, E, F, G}; | ||
|
||
fn main() { | ||
let chord = E.dom7(); | ||
println!("E7: {chord:X}"); | ||
|
||
let bar0 = Bar::new().with_silence(1); | ||
let bar1 = Bar::new().with_chord(D.min7(), 1); | ||
let bar2 = Bar::new().with_chord(G.dom7(), 1); | ||
let bar3 = Bar::new().with_chord(C.maj7(), 1); | ||
let bar4 = Bar::new().with_chord(F.maj7(), 1); | ||
let bar5 = Bar::new().with_chord(B.min7b5(), 1); | ||
let bar6 = Bar::new().with_chord(E.dom7(), 1); | ||
let bar7 = Bar::new().with_chord(A.min7(), 1); | ||
let s = [bar0, bar1, bar2, bar3, bar4, bar5, bar6, bar7] | ||
.into_iter() | ||
.map(|bar| format!("{bar}")) | ||
.collect::<Vec<_>>() | ||
.join(" | "); | ||
println!("LH: | {s} |"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use super::Scales; | ||
use crate::Note; | ||
|
||
pub fn minor(tonic: Note) -> Scales { | ||
let steps = [3, 2, 2, 3]; | ||
Scales::minor_with_steps(" penta_minor", tonic, steps.into_iter()) | ||
} | ||
|
||
pub fn pentatonic_minor(tonic: Note) -> Scales { | ||
let steps = [3, 2, 2, 3, 2]; | ||
Scales::minor_with_steps(" penta minor", tonic, steps.into_iter()) | ||
} | ||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use crate::{A, C}; | ||
|
||
#[test] | ||
fn test_minor() { | ||
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]"); | ||
} | ||
|
||
#[test] | ||
fn test_penta_minor() { | ||
let scale = pentatonic_minor(A); | ||
assert_eq!(format!("{scale:X}"), "A penta minor [A, C, D, E, G, A]"); | ||
assert_eq!(format!("{scale:x}"), "A penta minor [A, C, D, E, G, A]"); | ||
|
||
let scale = pentatonic_minor(D); | ||
assert_eq!(format!("{scale:X}"), "D penta minor [D, E, F, G, B, D]"); | ||
assert_eq!(format!("{scale:x}"), "D penta minor [D, E, F, G, B, D]"); | ||
} | ||
} |