prezjordan/Melopy — Issue #36: [minor] Scale generation doesn't work properly
Author: prezjordan
Created: 2012-01-04 05:13:56+00:00
State: open

The reason I've marked this as minor is that anyone with a good music theory background should be able to fix this pretty quickly.

```
>>> minor_scale('C')
['C4', 'D4', 'D#4', 'F4', 'G4', 'G#4', 'A#4']
>>>
```

As you can see here, Melopy determines that D and D# are both in C minor. This is technically correct, but the real way to write this would be to use D and then Eb. The same goes for Ab instead of G#. Essentially, the rule of thumb is that the same letter can't appear twice in a scale. The error lies in our `iterate()` method in `scales.py`.

```
def iterate(start, pattern, rType="list"):
"""Iterates over a pattern starting at a given note"""
start_key = key_from_note(start)
ret = [start_key]
for step in pattern:
ret.append(ret[-1] + step)
ret = map(note_from_key, ret)
return bReturn(ret, rType)
```

All we need is to implement an error checking that prevents the same letter from appearing twice.