saebekassebil / teoria

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

Fix simple interval calculation for descending intervals #42

Closed seanyeh closed 10 years ago

seanyeh commented 10 years ago

Hi, I found a bug in the simple interval calculation for descending compound intervals (of a multiple of 7).

Here is an example:

teoria.interval("M-13").simple()
=> "M-6" // Expected.
teoria.interval("M-14").simple()
=> "M7" // Wrong! Should be "M-7".

Descending intervals of a multiple of 7 lose its negative sign. Attached is a fix and a quick test case for this scenario. Please let me know if my changes are appropriate.

Thanks :) Sean

saebekassebil commented 10 years ago

Hi @seanyeh, nicely spotted! Thanks for contributing this pull-request - that's great!

I've commented on your fix, let me know what you think of that, and I'll pull this. And nice with the included test!

Best regards, Jakob

seanyeh commented 10 years ago

I just amended my last commit. I think that's the right way to do it?

saebekassebil commented 10 years ago

Thanks for the fix @seanyeh !