# Path: camp/core/note.py
# def note(st):
#     """
#     note('Db3') -> Note(name='Db', octave=3)
#     """
#     if type(st) == Note:
#         return st
#     match = NOTE_SHORTCUT_REGEX.match(st)
#     if not match:
#         raise Exception("cannot form note from: %s" % st)
#     name = match.group(1)
#     octave = match.group(2)
#     if octave == '' or octave is None:
#         octave = 4
#     octave = int(octave)
#     return Note(name=name, octave=octave)


from camp.core.note import note
   locrian            = [ 1, 'b2', 'b3', 4, 'b5', 'b6', 'b7' ],
   lydian             = [ 1, 2, 3, 'b4', 5, 6, 7 ],
   major_pentatonic   = [ 1, 2, 3, 5, 6 ],
   melodic_minor_asc  = [ 1, 2, 'b3', 4, 5, 'b7', 'b8', 8 ],
   melodic_minor_desc = [ 1, 2, 'b3', 4, 5, 'b6', 'b7', 8 ],
   minor_pentatonic   = [ 1, 'b3', 4, 5, 'b7' ],
   mixolydian         = [ 1, 2, 3, 4, 5, 6, 'b7' ],
   phyrigian          = [ 1, 'b2', 'b3', 4, 5, 'b6', 'b7' ],
)

SCALE_ALIASES = dict(
   aeolian = 'natural_minor',
   ionian = 'major',
   minor = 'natural_minor'
)


class Scale(object):

    def __init__(self, root=None, typ=None):

        """
        Constructs a scale:

	scale = Scale(root='C4', typ='major')
        """

        assert root is not None
        assert typ is not None
        if isinstance(root, str):

# Path: camp/core/note.py
# def note(st):
#     """
#     note('Db3') -> Note(name='Db', octave=3)
#     """
#     if type(st) == Note:
#         return st
#     match = NOTE_SHORTCUT_REGEX.match(st)
#     if not match:
#         raise Exception("cannot form note from: %s" % st)
#     name = match.group(1)
#     octave = match.group(2)
#     if octave == '' or octave is None:
#         octave = 4
#     octave = int(octave)
#     return Note(name=name, octave=octave)


# Path: camp/core/scale.py
from camp.core.note import note

   locrian            = [ 1, 'b2', 'b3', 4, 'b5', 'b6', 'b7' ],
   lydian             = [ 1, 2, 3, 'b4', 5, 6, 7 ],
   major_pentatonic   = [ 1, 2, 3, 5, 6 ],
   melodic_minor_asc  = [ 1, 2, 'b3', 4, 5, 'b7', 'b8', 8 ],
   melodic_minor_desc = [ 1, 2, 'b3', 4, 5, 'b6', 'b7', 8 ],
   minor_pentatonic   = [ 1, 'b3', 4, 5, 'b7' ],
   mixolydian         = [ 1, 2, 3, 4, 5, 6, 'b7' ],
   phyrigian          = [ 1, 'b2', 'b3', 4, 5, 'b6', 'b7' ],
)

SCALE_ALIASES = dict(
   aeolian = 'natural_minor',
   ionian = 'major',
   minor = 'natural_minor'
)


class Scale(object):

    def __init__(self, root=None, typ=None):

        """
        Constructs a scale:

	scale = Scale(root='C4', typ='major')
        """

        assert root is not None
        assert typ is not None
        if isinstance(root, str):

            root = note(root)