def save(name): s = system.get_system() sf.write(f"output/{name}.wav", s.output.samples, s.output.rate) ( ffmpeg .input(f"output/{name}.wav") .output(f"output/{name}.mp3") .run(quiet=True) )
def add_generator(id, name): s = system.get_system() gen_class = generators.get_generator(id) gen = gen_class() params = gen.get_parameters() if params != None: user_params = {} print(f"{id} generator setup:") for param in params: user_in = input(f"{param} ({params[param]}) $ ") if len(user_in) == 0: user_params[param] = params[param] elif isinstance(params[param], str): user_params[param] = user_in else: user_val = eval(user_in) user_params[param] = user_val gen.set_parameters(user_params) s.add_generator(name, gen) print(f"Created gen {name}!")
def add_preprocessor(id, name): s = system.get_system() preprocessor_class = preprocessors.get_preprocessor(id) preprocessor = preprocessor_class() params = preprocessor.get_parameters() if params != None: user_params = {} print(f"{id} preprocessor setup:") for param in params: user_in = input(f"{param} ({params[param]}) $ ") if len(user_in) == 0: user_params[param] = params[param] elif isinstance(params[param], str): user_params[param] = user_in else: user_val = eval(user_in) user_params[param] = user_val preprocessor.set_parameters(user_params) s.add_preprocessor(name, preprocessor) print(f"Created preprocessor {name}!")
def play_output(): s = system.get_system() sd.play(s.output.samples, s.output.rate)
def command_pure(): s = system.get_system() s.generate_pure() winsound.Beep(440, 500); winsound.Beep(880, 500)
def load_midi(id): s = system.get_system() midi = notes.read_midi(id) print(", ".join([l.name for l in midi])) s.set_midi(midi)
def play_audio(): s = system.get_system() s.audio_source.play()
def load_audio(id): s = system.get_system() s.set_audio(audio.read_dataset(id))
def test_preprocess(): s = system.get_system() s.preprocess()