def genMotif(prev_note = random.choice([0,2,4,7]), chords = [[0,2,4],[0,2,4]], cell1 = None): #generate first cell start_chord = chords[0] if cell1 == None: cell1 = gc.genCell(2.0, prev_note, first_note = None, chord=start_chord, durs=[], cell_type=None) #now generate second cell from first cell end_chord = chords[1] if random.uniform(0, 1) < 0.8 and len(set(cell1.durs)) > 1 and 0.33333333 not in cell1.durs: return [cell1, tf.transformCell(cell1, cell1, end_chord)] else: if end_chord == None: end_chord = hm.getHighestProbChord(start_chord, None) cell2 = gc.genCell(2.0, cell1.pits[-1], None, end_chord, [], None) return [cell1, cell2]
def transformFirstCellTwice(transform_motif, prev_cell = gc.genBlankCell(2.0), chords = [[0,2,4],[0,2,4]]): cell1 = tf.transformCell(transform_motif[0], prev_cell, chords[0]) cell2 = tf.transformCell(transform_motif[0], cell1, chords[1]) return [cell1, cell2]
def switchFirstSecond(transform_motif, prev_cell = gc.genBlankCell(2.0), chords = [[0,2,4],[0,2,4]]): cell1 = tf.transformCell(transform_motif[1], prev_cell, chords[0]) cell2 = tf.transformCell(transform_motif[0], cell1, chords[1]) return [cell1, cell2]
def transformFirstChangeSecond(transform_motif, prev_cell = gc.genBlankCell(2.0), chords = [[0,2,4],[0,2,4]]): cell1 = tf.transformCell(transform_motif[0], prev_cell, chords[0]) cell2 = gc.genCell(length=2.0, prev_note=cell1.pits[-1], chord=chords[1]) return [cell1, cell2]