def hello_world(): project = Project() fm = project.new_module(m.Fm, m_feedback=42) project.connect(fm, project.output) init(None, 44100, 2, 0) with Slot(project) as slot: slot.send_event(0, 42, 32, fm, 0, 0) print("Press Enter to close") input() slot.stop() deinit()
def dump(props, patch, output_dir, dirname): patch_dir = f"{output_dir}/{dirname}/{patch['name']}" os.makedirs(patch_dir, exist_ok=True) proj = Project() proj.initial_bpm = props["bpm"] proj.initial_tpl = props["tpl"] layout = module_layout(len(patch["modules"])) for i, mod in enumerate(reversed(patch["modules"][:-1])): mod.x, mod.y = layout[i] proj.attach_module(mod) for i in range(len(proj.modules) - 1): proj.connect(proj.modules[i + 1], proj.modules[i]) proj.patterns.append(patch["pattern"]) destfilename = f"{patch_dir}/{patch['x']}.sunvox" with open(destfilename, "wb") as f: proj.write_to(f)
def dump(props, patch, output_dir, dirname): patch_dir = f"{output_dir}/{dirname}/{patch['name']}" os.makedirs(patch_dir, exist_ok=True) proj = Project() proj.initial_bpm = props["bpm"] proj.initial_tpl = props["tpl"] layout = module_layout(len(patch["modules"])) for i, mod in enumerate(reversed(patch["modules"][:-1])): mod.x, mod.y = layout[i] proj.attach_module(mod) for i in range(len(proj.modules) - 1): proj.connect(proj.modules[i + 1], proj.modules[i]) proj.patterns.append(patch["pattern"]) destfilename = f"{patch_dir}/{patch['x']}.sunvox" with open(destfilename, "wb") as f: proj.write_to(f)