if(m == 0): m = 1 for i in l: result.append(i/m) return result def square(l): result = [] for i in l: result.append(i*i) return result if len(sys.argv) > 1: notes = sys.argv[1] deltas = [int(x) for x in sys.argv[2]] s3 = structure.second_order_deltarule(notes, deltas, 0) print(tools.recursive_print(s3)) sys.exit(0) selection = db.select() score = Score(db.getScore1(selection).stripTies()) melody = score.melody() notes = tools.parseScore(melody) deltas = [] print("COMBINED DELTA TREES") #for feature in [structure.pitch, structure.onset]: # deltas.append(normalize(structure.repetition(feature, notes)))
mozart2 = ('Mozart', 'snt331-1', 'mo', None) lastig = ('Bach', 'wtc219-f', 'richt', 'GPO-Concert-Steinway-ver2.sf2') score = Score(db.getScore1(chopin1).stripTies()) melody = score.melody() chopinnotes = tools.parseScore(melody) delta = structure.absolute_deltalist(structure.onset, chopinnotes) sodelta1 = structure.normalize(structure.second_order_deltalist(delta)) score = Score(db.getScore1(mozart2).stripTies()) melody = score.melody() mozartnotes = tools.parseScore(melody) delta2 = structure.square(structure.absolute_deltalist(structure.pitch, mozartnotes)) sodelta2 = structure.normalize(structure.second_order_deltalist(delta2)) s1 = structure.second_order_deltarule(chopinnotes, sodelta1, 0.1) s2 = structure.second_order_deltarule(mozartnotes, sodelta2, 0.1) while True: choice = util.menu("Select", ['Schumann exp', 'Schumann score', 'Schumann noexp', 'chopin struct', 'lastig struct bach', 'struct moz']) if choice == 0: path = db.getPerformancePath1(schumann) os.system("audacious {0}".format(path)) if choice == 1: os.system("viewmxml {0}".format(db.getScorePath1(schumann))) if choice == 2: path = db.getScoreMidiPath1(schumann) os.system("audacious {0}".format(path)) if choice == 3: groups = structure.groupings(structure.list_to_tree(s1), 1) structured_notes = []