Skip to content

Commit

Permalink
Fix the keys
Browse files Browse the repository at this point in the history
  • Loading branch information
veminovici committed Mar 19, 2024
1 parent c112bd2 commit e648189
Showing 1 changed file with 51 additions and 7 deletions.
58 changes: 51 additions & 7 deletions examples/exercise5.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
use musika_rs::*;

/// [Resource](https://www.youtube.com/watch?v=WrLFCznbNMw)
/// | Dm9 Dm9 | G13 G13 | Dm9 Dm9 | G13 G13 |
/// | Cmaj9 Cmaj9 | Fmaj13 Fmaj13 | Cmaj9 Cmaj9 | A7b9b13 |
fn main() {
println!();
println!("Exercise 5: | Dm9x2 | G13x2 | Cmaj9x2 | Fmaj13X2 | A7 | Dm | G | C |");

fn key_c_major() {
// Bar1
let bar1 = Bar::new().with_chord(D.min9(), 2).with_chord(D.min9(), 2);
let bar2 = Bar::new().with_chord(G.dom13(), 2).with_chord(G.dom13(), 2);
Expand Down Expand Up @@ -35,3 +29,53 @@ fn main() {
.join(" | ");
println!("| {s} |");
}

fn key_f_major() {
// Bar1
// D -> G [D, F, G]
// G -> C [G, A, B]

let bar1 = Bar::new().with_chord(G.min9(), 2).with_chord(G.min9(), 2);
let bar2 = Bar::new().with_chord(C.dom13(), 2).with_chord(G.dom13(), 2);

let line1 = [&bar1, &bar2, &bar1, &bar2];
let s = line1
.iter()
.map(|b| format!("{}", b))
.collect::<Vec<_>>()
.as_slice()
.join(" | ");
println!("| {s} |");

// C -> F [C, D, E, F]
// F -> Bb
let bar3 = Bar::new().with_chord(C.maj9(), 2).with_chord(C.maj9(), 2);
let bar4 = Bar::new()
.with_chord(A_SHARP.maj13(), 2)
.with_chord(A_SHARP.maj13(), 2);
// A -> D [A, B, C, D]
let bar5 = Bar::new()
.with_chord(D.dom13b9b13(), 2)
.with_chord(D.dom13b9b13(), 2);

let line2 = [&bar3, &bar4, &bar3, &bar5];
let s = line2
.iter()
.map(|b| format!("{}", b))
.collect::<Vec<_>>()
.as_slice()
.join(" | ");
println!("| {s} |");
}

/// [Resource](https://www.youtube.com/watch?v=WrLFCznbNMw)
/// | Dm9 Dm9 | G13 G13 | Dm9 Dm9 | G13 G13 |
/// | Cmaj9 Cmaj9 | Fmaj13 Fmaj13 | Cmaj9 Cmaj9 | A7b9b13 |
fn main() {
println!("Exercise 5: | Dm9x2 | G13x2 | Cmaj9x2 | Fmaj13X2 | A7 | Dm | G | C |");

println!("Key: C");
key_c_major();
println!("Key: F");
key_f_major();
}

0 comments on commit e648189

Please sign in to comment.