ziqiangao commited on
Commit
a37de4d
·
1 Parent(s): d7b1b38

change smartmode process

Browse files
Files changed (1) hide show
  1. app.py +9 -13
app.py CHANGED
@@ -285,20 +285,16 @@ def smart_mode_process(input_file, api_key, multi_singer=False):
285
  crowd, _ = download_wav(crowd_resp['files'][0]['url'], target_fs=fs)
286
  other_after_crowd, _ = download_wav(crowd_resp['files'][1]['url'], target_fs=fs)
287
 
288
- # Step 3: Reverb removal on "other" part
289
- p((3, 8), "Removing Reverb")
290
- other_buf = tempfile.NamedTemporaryFile(suffix=".flac", delete=False)
291
- sf.write(other_buf.name, other_after_crowd, fs, format='FLAC', subtype='PCM_16')
292
- other_buf.close()
293
-
294
- reverb_resp = send_mvsep_audio_job(
295
- api_key, open(other_buf.name, 'rb').read(), os.path.basename(other_buf.name),
296
- sep_type=22, output_format=2, addopt1=0, addopt2=1
297
- )
298
- os.unlink(other_buf.name)
299
 
300
- # Ignore first file (no reverb), use second for SL/SR
301
- reverb, _ = download_wav(reverb_resp['files'][1]['url'], target_fs=fs)
 
 
302
 
303
  # Step 4: Speech, music, SFX separation from 'other_after_crowd'
304
  p((4, 8), "Separating Speech, Music, and SFX")
 
285
  crowd, _ = download_wav(crowd_resp['files'][0]['url'], target_fs=fs)
286
  other_after_crowd, _ = download_wav(crowd_resp['files'][1]['url'], target_fs=fs)
287
 
288
+ # Step 3: Reverb using SoX (like regular mode)
289
+ p((3, 8), "Applying Reverb")
290
+
291
+ # Use the same reverb_args as 'open' preset from create_5_1_surround
292
+ reverb_args = ['70', '40', '100', '95', '10', '0'] # music preset
 
 
 
 
 
 
293
 
294
+ # Apply reverb to left and right channels separately
295
+ reverb_L = apply_reverb_wet_only(other_after_crowd[:, 0], fs, reverb_args)
296
+ reverb_R = apply_reverb_wet_only(other_after_crowd[:, 1], fs, reverb_args)
297
+ reverb = np.column_stack([reverb_L, reverb_R])
298
 
299
  # Step 4: Speech, music, SFX separation from 'other_after_crowd'
300
  p((4, 8), "Separating Speech, Music, and SFX")