pedrozath / coltrane

🎹🎸A music theory library with a command-line interface

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coltrane doesn't display enharmonic intervals correctly

art-of-dom opened this issue · comments

Coltrane does not give the correct name when creating an interval that has a more common enharmonic equivalent. Due to this, Coltrane cannot be used for music theory centric applications.

This interval is C to D (or D _down to _ C) and should be a Major Second (Correct)

2.5.0 :007 > interval = Coltrane::Note['D'] - Coltrane::Note['C']
 => #<Coltrane::IntervalClass:0x000000000142e248 @cents=200> 
2.5.0 :008 > interval.name
 => "M2" 

This interval is C to D# (or D# _down to _ C) and should be an Augmented Second (Wrong)

2.5.0 :009 > interval = Coltrane::Note['D#'] - Coltrane::Note['C']
 => #<Coltrane::IntervalClass:0x00000000013e46c0 @cents=300> 
2.5.0 :010 > interval.name
 => "m3" 

This interval is F to B (or B _down to _ F) and should be an Augmented Fourth (Correct)

> 2.5.0 :017 > interval = Coltrane::Note['B'] - Coltrane::Note['F']
>  => #<Coltrane::IntervalClass:0x00000000016d3958 @cents=600> 
> 2.5.0 :018 > interval.name
>  => "A4" 

This interval is B to F (or F _down to _ B) and should be a diminished fifth (Wrong, it gives and Augmented Fourth)

> 2.5.0 :017 > interval = Coltrane::Note['F'] - Coltrane::Note['B']
>  => #<Coltrane::IntervalClass:0x00000000016d3958 @cents=600> 
> 2.5.0 :018 > interval.name
>  => "A4" 

This interval is B to Fb (or Fb _down to _ B) and should be a doubly diminished fifth (Wrong, it gives a Perfect 4th)

2.5.0 :033 > interval = Coltrane::Note['Fb'] - Coltrane::Note['B']
 => #<Coltrane::IntervalClass:0x0000000001514810 @cents=500> 
2.5.0 :034 > interval.name
 => "P4" 

Alright. Can you better explain me how does that work? I think it's not hard to implement this.

What's the general rule? Why doubly diminished fifth instead of perfect fourth?

Intervals are a measure of two distances which are letter distance and distance in semitones. So any B up to any F must be some kind of 5th. A perfect fourth up from B would be an E and while the enharmonic equivelent note would be Fb, how the notes are spelled affect the intervals name since letter name is apart of the calculation.

Alright. Thanks a lot for this information.

Technically this is solved now. I had to completely refactor interval code for that. Would appreciate a lot if you could confirm :)