def record_prog_stats(data): progressions = {} #ending progressions for chorale in data: table = che.table_from_chorale(chorale) table = tableify(table) last_prog= tuple([tuple(i) for i in table[-16:]]) progressions[last_prog] = progressions.get(last_prog, 0) + 1 #print progressions.values() return progressions
def record_prog_stats(data): progressions = {} #ending progressions for chorale in data: table = che.table_from_chorale(chorale) table = tableify(table) last_prog = tuple([tuple(i) for i in table[-16:]]) progressions[last_prog] = progressions.get(last_prog, 0) + 1 #print progressions.values() return progressions
def testGeneration(): """take a midi of an original chorale, table-fy it, take first chord, generate a new table from our energies, compare""" #will return a loss for the specific values of alpha beta gamma (sorority?) print "starting the test" #midifile = "../dataset/fourPartChorales/039200b_.mid" #json_dict = midiTojson.genJson(midifile) #for chorale in data: #json_dict = chorale #break json_dict = data[5] #tableify test_table = che.table_from_chorale(json_dict) g = Graph() """ endTime = che.chorale_end_time(json_dict) for time in range(0,endTime-1): chordList = map(lambda v: v[time], test_table) first_chord = tuple(chordList) break """ #first_chord = test_table[0] #print first_chord #first_chord = g.chords.get(tuple(first_chord)) print "generate!" #flip test_table test_table = tableify(test_table) first_chord = g.chords.get(tuple(test_table[0])) assert (first_chord) generated_sequence = generate(first_chord, 50) #write that to a midi chords_to_midi(generated_sequence) total_loss = 0 for i in range(50): total_loss += lossify(test_table[i], generated_sequence[i].chord) print "total loss is: ", total_loss
def testCopitchMap(self): e.copitch_map(e.table_from_chorale(self.chorale))