Closed saebekassebil closed 11 years ago
@saebekassebil great work! I have no objection to these changes. This opens up the door for adding support for different temperaments/microtones.
I'd like the unit tests you have. I think it would be fun to add some audio tests as well using the web audio api and also add some audio to http://saebekassebil.github.io/teoria/.
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.