diff --git a/fluidsynth.py b/fluidsynth.py index 043642c..157c6ed 100644 --- a/fluidsynth.py +++ b/fluidsynth.py @@ -618,16 +618,6 @@ class fluid_midi_router_t(Structure): ('rule', c_void_p, 1), ('type', c_int, 1)) -# fluid file renderer -new_fluid_file_renderer = cfunc('new_fluid_file_renderer', c_void_p, - ('synth', c_void_p, 1)) - -delete_fluid_file_renderer = cfunc('delete_fluid_file_renderer', None, - ('renderer', c_void_p, 1)) - -fluid_file_renderer_process_block = cfunc('fluid_file_renderer_process_block', c_int, - ('render', c_void_p, 1)) - # fluidsynth 2.x new_fluid_cmd_handler=cfunc('new_fluid_cmd_handler', c_void_p, ('synth', c_void_p, 1), @@ -703,8 +693,6 @@ def __init__(self, gain=0.2, samplerate=44100, channels=256, **kwargs): self.midi_driver = None self.router = None self.custom_router_callback = None - def __del__(self): - self.delete() def setting(self, opt, val): """change an arbitrary synth setting, type-smart""" if isinstance(val, (str, bytes)): @@ -1082,19 +1070,7 @@ def play_midi_stop(self): def player_set_tempo(self, tempo_type, tempo): return fluid_player_set_tempo(self.player, tempo_type, tempo) - - def midi2audio(self, midifile, audiofile = "output.wav"): - """Convert a midi file to an audio file""" - self.setting("audio.file.name", audiofile) - player = new_fluid_player(self.synth) - fluid_player_add(player, midifile.encode()) - fluid_player_play(player) - renderer = new_fluid_file_renderer(self.synth) - while(fluid_player_get_status(player) == FLUID_PLAYER_PLAYING): - if(fluid_file_renderer_process_block(renderer) != FLUID_OK): - break - delete_fluid_file_renderer(renderer) - delete_fluid_player(player) + class Sequencer: diff --git a/test/test7.py b/test/test7.py deleted file mode 100644 index 09b5a5c..0000000 --- a/test/test7.py +++ /dev/null @@ -1,17 +0,0 @@ -import fluidsynth - - -def local_file_path(file_name: str) -> str: - """ - Return a file path to a file that is in the same directory as this file. - """ - from os.path import dirname, join - - return join(dirname(__file__), file_name) - -fs = fluidsynth.Synth() -sfid = fs.sfload(local_file_path("example.sf2")) -fs.midi2audio(local_file_path("1080-c01.mid"), local_file_path("1080-c01.wav")) -# A Synth object can synthesize multiple files. For example: -# fs.midi2audio(local_file_path("1080-c02.mid"), local_file_path("1080-c02.wav")) -# fs.midi2audio(local_file_path("1080-c03.mid"), local_file_path("1080-c03.wav"))