diff --git a/tune-cli/README.md b/tune-cli/README.md index 0d6617db..81ac94ed 100644 --- a/tune-cli/README.md +++ b/tune-cli/README.md @@ -132,7 +132,7 @@ The `tune edo` command prints basic information about any EDO scale. The step si Example output of `tune edo 17`: ```rust ----- Properties of 17-EDO ---- +---- Properties of 17-EDO (Meantone) ---- Number of cycles: 1 1 fifth = 10 EDO steps = +705.9c = Pythagorean +3.9c diff --git a/tune-cli/src/edo.rs b/tune-cli/src/edo.rs index 64d8efeb..aada2da9 100644 --- a/tune-cli/src/edo.rs +++ b/tune-cli/src/edo.rs @@ -2,15 +2,34 @@ use std::io; use tune::{ key::{Keyboard, PianoKey}, ratio::Ratio, - temperament::EqualTemperament, + temperament::{EqualTemperament, TemperamentType}, }; pub fn print_info(mut dst: impl io::Write, num_steps_per_octave: u16) -> io::Result<()> { let temperament = EqualTemperament::find().by_edo(num_steps_per_octave); + print_temperament(&mut dst, &temperament)?; + match temperament.temperament_type() { + TemperamentType::Meantone => { + if let Some(porcupine) = temperament.as_porcupine() { + writeln!(dst)?; + print_temperament(dst, &porcupine)?; + } + } + TemperamentType::Porcupine => {} + } + + Ok(()) +} + +pub fn print_temperament( + mut dst: impl io::Write, + temperament: &EqualTemperament, +) -> io::Result<()> { writeln!( dst, - "---- Properties of {}-EDO ----", - temperament.num_steps_per_octave() + "---- Properties of {}-EDO ({}) ----", + temperament.num_steps_per_octave(), + temperament.temperament_type() )?; writeln!(dst)?; @@ -52,7 +71,7 @@ pub fn print_info(mut dst: impl io::Write, num_steps_per_octave: u16) -> io::Res keyboard .get_key(x, y) .midi_number() - .rem_euclid(i32::from(num_steps_per_octave)), + .rem_euclid(i32::from(temperament.num_steps_per_octave())), )?; } writeln!(dst)?; diff --git a/tune-cli/tests/snapshots/edo_15.stdout b/tune-cli/tests/snapshots/edo_15.stdout index 39fda007..2c122a1f 100644 --- a/tune-cli/tests/snapshots/edo_15.stdout +++ b/tune-cli/tests/snapshots/edo_15.stdout @@ -1,4 +1,4 @@ ----- Properties of 15-EDO ---- +---- Properties of 15-EDO (Meantone) ---- Number of cycles: 3 1 fifth = 9 EDO steps = +720.0c = Pythagorean +18.0c @@ -34,3 +34,40 @@ Number of cycles: 3 12. B / C 13. B^ / C^ 14. B^^ / C^^ + +---- Properties of 15-EDO (Porcupine) ---- + +Number of cycles: 1 +1 fifth = 9 EDO steps = +720.0c = Pythagorean +18.0c +1 primary step = 2 EDO steps +1 secondary step = 3 EDO steps +1 sharp = 1 EDO steps + +-- Keyboard layout -- + 3 5 7 9 11 13 0 2 4 6 + 6 8 10 12 14 1 3 5 7 9 + 9 11 13 0 2 4 6 8 10 12 + 12 14 1 3 5 7 9 11 13 0 + 0 2 4 6 8 10 12 14 1 3 + 3 5 7 9 11 13 0 2 4 6 + 6 8 10 12 14 1 3 5 7 9 + 9 11 13 0 2 4 6 8 10 12 + 12 14 1 3 5 7 9 11 13 0 + 0 2 4 6 8 10 12 14 1 3 + +-- Scale steps -- + 0. D + 1. Eb / D# + 2. E + 3. Fb / E# + 4. F **Minor 3rd** + 5. Gb / F# **Major 3rd** + 6. G **4th** + 7. G# + 8. Ab + 9. A **5th** + 10. Bb / A# + 11. B + 12. Cb / B# + 13. C + 14. Db / C# diff --git a/tune-cli/tests/snapshots/edo_16.stdout b/tune-cli/tests/snapshots/edo_16.stdout index e27a226f..b23b57ec 100644 --- a/tune-cli/tests/snapshots/edo_16.stdout +++ b/tune-cli/tests/snapshots/edo_16.stdout @@ -1,4 +1,4 @@ ----- Properties of 16-EDO ---- +---- Properties of 16-EDO (Meantone) ---- Number of cycles: 1 1 fifth = 9 EDO steps = +675.0c = Pythagorean -27.0c