Harvard-ATG/HarmonyLab — pull request #26 by arthurian (2013-11-07 18:51:18+00:00)
Title: feature/fix-interval-entry

This PR fixes an issue with "no key" analysis of chords and in particular the intervals above the bass. The issue is that several different chords should map to the same interval entry that appears in the analysis table, but there seems to be a bug where depending on the order of the notes, the mapping is incorrect.

The issue is in the `getIntervalsAboveBass(notes)` function, which was obtaining the correct intervals, but sometimes it wasn't returning them in the correct order. The solution was basically to sort the intervals after they were obtained and then convert them to the entry string (mash the intervals above the bass together).

Concrete example:
- Notes [65,69,72] should map to entry "47" because those are notes F,A,C with pitch classes 0,4,7. The bass is F, pitch 0, so the result should be entry string "47."
- Notes [53,69,72] should map to entry "47" because those are notes F,A,C with pitch classes 0,4,7. The bass is F, pitch 0, so the result should be entry string "47."
- Notes: [53, 60, 69] should map to entry "47" because those are notes F,C,A with pitch classes 0,7,4. The bass is F, pitch 0, so the result should be an entry string "47", but instead the entry string was "74."

So this PR fixes that issue and also refactors several supporting/related methods and includes a unit test for the method that was fixed.