tianhk commited on
Commit
ed4639a
·
1 Parent(s): 197ceb1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -19,15 +19,13 @@ def midi_ddsp_synth(instrument, midi_file):
19
  fs: the sampling rate
20
  x: the audio data
21
  '''
22
- print(midi_file.name)
23
- print(Path(midi_file.name))
24
- print(Path(midi_file.name).stem)
25
- if not (os.path.isfile(midi_file) and midi_file[-4:] == '.mid'):
26
  raise FileNotFoundError('Error: not a valid midi file')
27
  if instrument not in INST_NAME_LIST:
28
  raise ValueError('Error: not an available instrument type')
29
  instrument_id = INST_NAME_TO_ID_DICT[instrument]
30
  sample_rate = 16000
 
31
  midi_audio, midi_control_params, midi_synth_params, conditioning_df = synthesize_mono_midi(synthesis_generator, expression_generator, midi_file, instrument_id, output_dir=None, pitch_offset=0, speed_rate=1)
32
  x = midi_audio[0].numpy()
33
  return gr.Audio(sample_rate, x)
 
19
  fs: the sampling rate
20
  x: the audio data
21
  '''
22
+ if not (os.path.isfile(midi_file.name) and midi_file.name[-4:] == '.mid'):
 
 
 
23
  raise FileNotFoundError('Error: not a valid midi file')
24
  if instrument not in INST_NAME_LIST:
25
  raise ValueError('Error: not an available instrument type')
26
  instrument_id = INST_NAME_TO_ID_DICT[instrument]
27
  sample_rate = 16000
28
+ print(instrument, instrument_id)
29
  midi_audio, midi_control_params, midi_synth_params, conditioning_df = synthesize_mono_midi(synthesis_generator, expression_generator, midi_file, instrument_id, output_dir=None, pitch_offset=0, speed_rate=1)
30
  x = midi_audio[0].numpy()
31
  return gr.Audio(sample_rate, x)