Skip to content

Commit

Permalink
Revert "enable midi -> audio (#83)" (#84)
Browse files Browse the repository at this point in the history
This reverts commit 4c07da9.
  • Loading branch information
cclauss authored Dec 6, 2024
1 parent 4c07da9 commit af83c1f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 42 deletions.
26 changes: 1 addition & 25 deletions fluidsynth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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)):
Expand Down Expand Up @@ -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:
Expand Down
17 changes: 0 additions & 17 deletions test/test7.py

This file was deleted.

0 comments on commit af83c1f

Please sign in to comment.