Use coords internally to represent notes and intervals #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This took a lot of work, but I've finally got around to finishing this up.
This pull request breaks a lot of the old API, by replacing many properties (such as
TeoriaNote.octave
) with functions (nowTeoriaNote#octave()
). This is due to the internal representation of aTeoriaNote
and aTeoriaInterval
. Both of these objects now have only one property:this.coord
.The
coord
property is an array with two elements:coord[octaves, fifths]
. Using octaves and fifths, it is possible to represent all notes (at least in the 12TET), with an arbitrary number of accidentals. AllTeoriaNote
s are now relative to the concert pitch, A4, which is the origo of the coordinate space:This API change has made it possible to remove a lot of tables from the code, which is great, because it leads to less redundancy.
I'd like to thank @gregjopa for his music.js, which I've borrowed the idea of representing notes with coords, from.
If there's no objections to these changes, I'll probably pull this, later this week.
/cc @gregjopa and @quickredfox whom I believe I've discussed this issue of abstracting out the note names with.