saebekassebil / teoria

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

Make note accidentals respect a key signature/scale? #101

Closed BHSPitMonkey closed 8 years ago

BHSPitMonkey commented 8 years ago

I'm wondering if Teoria has a way of figuring out the appropriate accidental for a note, with respect to a given key signature (or Scale object, more probably).

More specifically: I would like to be able to create a Bb major Chord with a F major Scale specified, and find no accidentals on any of the notes in that scale. I was looking around for a way to pass a Scale to teoria.chord(...), or maybe find a chord generator as a method of Scale, but didn't find anything. Does this functionality currently exist in some form?

BHSPitMonkey commented 8 years ago

Actually, I might not have a use case for this anymore; the engraving library I'm using is able to do this. Leaving this issue open for discussion in case anyone has thoughts.

saebekassebil commented 8 years ago

Wouldn't it be enough to iterate trough all your notes, checking if they're in the current scale (with Note.scaleDegree) and deciding whether to show the accidental based on that?

Cheers, and thanks for reporting! Jakob

Den 1. mar. 2016 kl. 06.18 skrev Stephen Eisenhauer notifications@github.com:

I'm wondering if Teoria has a way of figuring out the appropriate accidental for a note, with respect to a given key signature (or Scale object, more probably).

More specifically: I would like to be able to create a Bb major Chord with a F major Scale specified, and find no accidentals on any of the notes in that scale. I was looking around for a way to pass a Scale to teoria.chord(...), or maybe find a chord generator as a method of Scale, but didn't find anything. Does this functionality currently exist in some form?

— Reply to this email directly or view it on GitHub.

BHSPitMonkey commented 8 years ago

I had actually started down that road, but realized it would need to be even smarter in cases where the same note appears more than once in the same measure. Given that Teoria doesn't track that kind of information, it's probably best to leave that behavior to an engraving engine. I'll go ahead and close this until someone comes along and has more to say!