Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
if len(failed) == 0:
	print "Passed all " + str(len(tests.keys())) + " tests for semitoneDistanceFromInterval."
else:
	passed = False
	print "Failed a total of " + str(len(failed)) + " tests for semitoneDistanceFromInterval."

for fail in failed:
	print fail

# tests for enharmonicSwitch
tests = {('B', 1):'Cb', ("C#", 1): "Db", ("E", 1): "Fb", ("G", -1): "F##", ("A#", 1): "Bb", ("Bb", -1): "A#", 
		("F", -1): "E#", ("C", -1): "B#"}
failed = []

for test in tests.keys():
	testValue = enharmonicSwitch(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 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"}