saebekassebil / teoria

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

modal scales? #111

Open edellaq opened 7 years ago

edellaq commented 7 years ago

From a musician perspective, would be useful being able to generate modal scales starting from each degree of a parent scale. So "dorian" e.g. would be generated as "major.mode(2)", "aeolian" would be "major.mode(6)", "lydian augmented" would be melodicminor.mode(3), and so on...

In this way with the usual 4 parent jazz scales (major, melodic minor, harmonic minor, harmonic major) we could have almost all the scales used in jazz. Synonims could be used anyway, so that e.g. "aeolian b5" is the same as "locrian #2" ( melodicminor.mode(6) ) Could be used also for synthetic scales (e.g. messiaen modes)

saebekassebil commented 7 years ago

Sounds like a really interesting idea! Feel free to come up with some way of doing it, and I'd be glad to incorporate it :)

edellaq commented 7 years ago

I think it's quite easy. I don't know the implications in terms of your code architecture, but it's simply a matter of counting the notes of a same scale, but starting from another degree.

The output would be tha same scale array, just with the note position shifted; e.g. for major scale: C Major (= C major mode (1)) : C, D, E, F, G, A, B D Dorian (= C major mode (2)) : D, E, F, G, A, B, C E Phrygian (= C major mode (3)) : E, F, G, A, B, C, D F Lydian (= C major mode (4)) : F, G, A, B, C, D, E G Mixolydian (= C major mode (5)) : G, A, B, C, D, E, F A Aeolian (= C major mode (6)) : A, B, C, D, E, F, G B Locrian (= C major mode (7)) : B, C, D, E, F, G, A

If you talk about mode 1, 2, etc.. any scale has its modes. If you talk about mode names, not all of them have one The most common are the major scale ones Other "parent" scales commonly used are the Melodic Minor and Harmonic Minor

I'll be happy to help if I can, in any way...

saebekassebil commented 7 years ago

yes I know of the diatonic modals and modes, and I think that your suggestion is quite good. However I'm wondering: should the scale object have an internal state of which mode it is in? Or maybe it would be simpler to just have the .mode function return a brand new scale.

What I mean is, should we internally represent 3. mode of C major as "phrygian E" or should it be "third inversion of C major, which is called E Phrygian"? I could accept both, although I think i prefer the simpler one with less internal state.

Right now I have very little time for these projects and I mainly just maintain it, so if you want to, you're very welcome to code up the solution. The codebase should be fairly simple and I'm always open to answer questions about it.

edellaq commented 7 years ago

Sorry, I misunderstood your question, so I took the liberty to explain.

If "scale" is an object type, the method scaleXY.mode(n) should return a similar new object, that himself would have the mode(x) method, so that e.g.: Major.mode(6) returns an Aeolian scale object, and Aeolian.mode(3) gives back a Major scale. About the naming... there isn't a clear nomencalture for all the modes, so I'd stay away, and give the programmer the task of using appropriate variable names.

I'll have a peek to the code, although I'm not sure I can do modifications without messing up... :)

saebekassebil commented 7 years ago

Yes, that seems like the right way to go :) Feel free to ask any questions to the code if you want to have a stab at it!

groos commented 5 years ago

I took a stab at implementing this - let me know what you think: https://github.com/saebekassebil/teoria/pull/126