saebekassebil / teoria

Javascript taught Music Theory
http://saebekassebil.github.io/teoria
MIT License
1.32k stars 114 forks source link

Fix interval equality #43

Closed seanyeh closed 10 years ago

seanyeh commented 10 years ago

Hi there again :) I found that the interval equal function doesn't quite work.

For example:

teoria.interval("P5").equal(teoria.interval("P8"))
=> true

Is there a reason not to compare this.coord with interval.coord directly? The problem with using sum is that if the result of sub(this.coord, interval.coord) were [n,-n], it will still return true. Let me know what you think!

Sean

saebekassebil commented 10 years ago

Ugh, that's a bit embarrassing - but a nice find. I guess it was in the transition to using a vector based note representation, that this bug has sneaked in.

No there's no good reason, AFAIK.

Cheers again Sean!