def __init__(self, sound_path, *args, **kwargs): ui.View.__init__(self, *args, **kwargs) self.bg_color = 'maroon' self.rack = RackGrid() self.rack.set_grid(sound_path) self.add_subview(self.rack) self.all_stop_btn = self.create_btn('iob:stop_32') self.all_stop_btn.action = (lambda sender: sound.stop_all_effects()) self.right_button_items = [self.all_stop_btn]
while True: yield from graph[key].stream.delayed(offset).stream if graph[key].edges: edge = random.choice(graph[key].edges) offset += edge.delta_t key = edge.key else: print("hit a dead end, starting from a random start") offset += 5 key = random.choice(list(graph.keys())) if __name__ == "__main__": console.clear() sound.stop_all_effects() gnossiennes = build_stream_from_midi("gnossiennes_1.mid") graph = build_graph(gnossiennes.stream) print(len(graph)) for key, node in graph.items(): print(key) for sound in node.stream.stream: print(sound) print(node.edges) print() with prevent_device_sleep(): chunk_and_play(walk_graph(graph))
def stop(self): sound.stop_all_effects()
def pause(self): sound.stop_all_effects()
def will_close(self): sound.stop_all_effects() self.event_loop.stop()
def stop(self): sound.stop_all_effects() self.finished = True