keshavbhandari commited on
Commit
881a14f
·
1 Parent(s): 364607e

testing app

Browse files
Files changed (1) hide show
  1. app.py +17 -17
app.py CHANGED
@@ -14,23 +14,23 @@ from miditok import REMI, TokenizerConfig
14
  from pathlib import Path
15
 
16
 
17
- # def save_wav(filepath):
18
- # # Extract the directory and the stem (filename without extension)
19
- # directory = os.path.dirname(filepath)
20
- # stem = os.path.splitext(os.path.basename(filepath))[0]
21
-
22
- # # Construct the full paths for MIDI and WAV files
23
- # midi_filepath = os.path.join(directory, f"{stem}.mid")
24
- # wav_filepath = os.path.join(directory, f"{stem}.wav")
25
-
26
- # # Run the fluidsynth command to convert MIDI to WAV
27
- # process = subprocess.Popen(
28
- # f"fluidsynth -r 16000 soundfont.sf2 -g 1.0 --quiet --no-shell {midi_filepath} -T wav -F {wav_filepath} > /dev/null",
29
- # shell=True
30
- # )
31
- # process.wait()
32
-
33
- # return wav_filepath
34
 
35
 
36
  # def post_processing(input_midi_path: str, output_midi_path: str):
 
14
  from pathlib import Path
15
 
16
 
17
+ def save_wav(filepath):
18
+ # Extract the directory and the stem (filename without extension)
19
+ directory = os.path.dirname(filepath)
20
+ stem = os.path.splitext(os.path.basename(filepath))[0]
21
+
22
+ # Construct the full paths for MIDI and WAV files
23
+ midi_filepath = os.path.join(directory, f"{stem}.mid")
24
+ wav_filepath = os.path.join(directory, f"{stem}.wav")
25
+
26
+ # Run the fluidsynth command to convert MIDI to WAV
27
+ process = subprocess.Popen(
28
+ f"fluidsynth -r 16000 soundfont.sf2 -g 1.0 --quiet --no-shell {midi_filepath} -T wav -F {wav_filepath} > /dev/null",
29
+ shell=True
30
+ )
31
+ process.wait()
32
+
33
+ return wav_filepath
34
 
35
 
36
  # def post_processing(input_midi_path: str, output_midi_path: str):