def bluesScale(note): notes = [note] notes.append(findNoteFromInterval(notes[-1], "m3")) notes.append(findNoteFromInterval(notes[-1], "M2")) notes.append(findNoteFromInterval(notes[-1], "m2")) notes.append(findNoteFromInterval(notes[-1], "A1")) notes.append(findNoteFromInterval(notes[-1], "m3")) return notes
def diminishedScale(note): notes = [note] notes.append(findNoteFromInterval(notes[-1], "m2")) notes.append(findNoteFromInterval(notes[-1], "M2")) notes.append(findNoteFromInterval(notes[-2], "A2")) notes.append(enharmonicSwitch(findNoteFromInterval(notes[-1], "M2"), 1)) notes.append(findNoteFromInterval(enharmonicSwitch(notes[-1], -1), "m2")) notes.append(findNoteFromInterval(notes[-1], "M2")) notes.append(findNoteFromInterval(notes[-1], "m2")) return notes
def lydianScale(note): notes = [note] notes.append(findNoteFromInterval(notes[-1], "M2")) notes.append(findNoteFromInterval(notes[-1], "M2")) notes.append(findNoteFromInterval(notes[-1], "M2")) notes.append(findNoteFromInterval(notes[-1], "m2")) notes.append(findNoteFromInterval(notes[-1], "M2")) notes.append(findNoteFromInterval(notes[-1], "M2")) return notes
def phrygianDominantScale(note): notes = [note] notes.append(findNoteFromInterval(notes[-1], "m2")) notes.append(findNoteFromInterval(notes[-1], "A2")) notes.append(findNoteFromInterval(notes[-1], "m2")) notes.append(findNoteFromInterval(notes[-1], "M2")) notes.append(findNoteFromInterval(notes[-1], "m2")) notes.append(findNoteFromInterval(notes[-1], "M2")) return notes
def harmonicMinorScale(note): notes = [note] notes.append(findNoteFromInterval(notes[-1], "M2")) notes.append(findNoteFromInterval(notes[-1], "m2")) notes.append(findNoteFromInterval(notes[-1], "M2")) notes.append(findNoteFromInterval(notes[-1], "M2")) notes.append(findNoteFromInterval(notes[-1], "m2")) notes.append(findNoteFromInterval(notes[-1], "A2")) return notes
if len(failed) == 0: print "Passed all " + str(len(tests.keys())) + " tests for enharmonicSwitch." else: passed = False print "Failed a total of " + str(len(failed)) + " tests for enharmonicSwitch." for fail in failed: print fail # tests for findNoteFromInterval tests = {('B1', "m2"):'C2', ("G#3", "P5"): "D#4", ("E3", "m3"): "G3", ("G4", "m7"): "F5", ("A#2", "P4"): "D#3", ("Bb3", "M6"): "G4", ("A3", "m2"): "Bb3"} failed = [] for test in tests.keys(): testValue = findNoteFromInterval(test[0], test[1]) if testValue != tests[test]: failed.append("Failed " + str(test) + ". Expected: " + tests[test] + " but got " + testValue) if len(failed) == 0: print "Passed all " + str(len(tests.keys())) + " tests for findNoteFromInterval." else: passed = False print "Failed a total of " + str(len(failed)) + " tests for findNoteFromInterval." for fail in failed: print fail if passed: print "Passed all tests for interval!"