Euterpea / Euterpea2

Euterpea version 2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

scales/modes?

jwaldmann opened this issue · comments

I wanted to use the diatonic scale, and transpose inside the scale. E.g.,
transpose 1 c should give d (whole note up), but transpose 1 e should give f (semi note up),
and a chord is [x, x+2, x+4], giving major, minor, or dim, depending on x.
Electribe2 does have such a chord mode.

Euterpea has chromatic scale everywhere, because MIDI does.

Still the source code (and API docs) mention Mode. But it's never used?

rg Major Euterpea2/
Euterpea2/Euterpea/Music.lhs
38:> data Mode = Major | Minor |

Euterpea's class ToMusic is already designed (I guess) to handle this:

One can make a newtype

data Diatonic = Diatonic Int

and define conversion to chromatic (via some table lookup)

instance ToMusic1 Diatonic where 
  toMusic1 = mMap ( \ (Diatonic i) -> (pitch _,  _) ) 

Then, transposition in the scale works

tr_dia d = mMap (\ (Diatonic i) -> Diatonic (i+d))

play $ tr_dia 2 $ note 1 $ Diatonic 0

The nice thing is that the type system will prohibit a confusion of scales (using a diatonic number as it were chromatic).

Yes, it'd be limited to notes in the scale. For diatonic, you'd get the things you can play "on the white keys", etc. I was thinking mainly for teaching. For making actual music, it's quite a restriction. But that's not necessarily bad? - Related: