def straight_bass( input_row, phrase_count=2, rhythm_tree=( (2, 2), (2, 2), ), input_start_beat=0, ): beat_counter = input_start_beat bass_line = ImaginaryLine() for i in range(phrase_count): bass_phrase = ImaginaryPhrase() for cell_r in rhythm_tree: bass_cell = ImaginaryCell() for r in cell_r: if r > 0: input_event = input_row.event_at_beat(beat_counter) # TO DO... think of being more flexifble to pull either cell/phrase, parent/grandparent input_node = input_event.parent.parent input_pitches = input_node.note_pitch_set my_pitch = chords.get_diatonic_root(input_pitches) - 24 else: my_pitch = "R" bass_cell.append(calliope.Event(beats=r, pitch=my_pitch)) beat_counter += abs(r) bass_phrase.append(bass_cell) bass_line.append(bass_phrase) return bass_line
def pad(self, beats=1, with_command=True): if beats > 0: floor_beats = math.floor(beats) remainder_beats = beats - floor_beats pad_cell = ImaginaryCell(rhythm=(1, ) * floor_beats, pitches=("S", ) * floor_beats) if remainder_beats: pad_cell.append( calliope.Event(beats=remainder_beats, pitch="S")) if with_command: pad_cell.events[0].tag("\\freePad") self.append(pad_cell) return pad_cell