saebekassebil / teoria

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

Interval.direction() doesn't distinguish accidentals of same note #105

Open eagor opened 8 years ago

eagor commented 8 years ago
var a = teoria.note('a'),
    ab = teoria.note('ab'),
    aS = teoria.note('a#');
ab.interval(a).direction(); // "up"
// but
a.interval(ab).direction(); // "up"
aS.interval(a).direction(); // "up"
aS.interval(ab).direction(); // "up"

interval from A# to Ab returns direction "up", even though Ab is 2 semitones down from A#.

saebekassebil commented 8 years ago

Hey Eagor.

I can see why that might be confusing behaviour. But actually it is working as "expected": The Interval#direction() method doesn't measure whether the interval goes up or down on the keyboard - but rather which direction the interval as "facing".

I'm not sure that there is such an interval as "diminished unison", but I kind of had to make it up to make the theory "complete". And to me a diminished is smaller than a perfect - and to make a perfect unison smaller a diminished unison must be a half-step lower. At least that's the reasoning.

I'm very open to listen to other suggestions on this behaviour if you have any input :)

eagor commented 8 years ago

Yeah, it's a bit misleading, as initially I would think that if you play two notes one after another, you would hear whether the melody goes up or down, hence the direction of the interval.

Or, maybe there is some other theoretical meaning of interval direction? Or what might be the use case expecting current behavior?

ps. anyways, great lib. The idea with .coord is genius!!!

eagor commented 8 years ago

maybe, this should go to a different thread, but I've just found this:

teoria.scale("cx", 'wholetone').simple()
> ["cx", "dx", "ex", "fundefined", "gundefined", "aundefined"]
saebekassebil commented 8 years ago

Well spotted! This should produce some kind of an error. Please open a new issue on this though.

Den 20. apr. 2016 kl. 13.24 skrev eagor notifications@github.com:

maybe, this should go to a different thread, but I've just found this:

teoria.scale("cx", 'wholetone').simple()

["cx", "dx", "ex", "fundefined", "gundefined", "aundefined"] — You are receiving this because you commented. Reply to this email directly or view it on GitHub