@@ -41,8 +41,8 @@ def wave_to_spectrogram(
4141 wave_left = np .asfortranarray (wave [0 ])
4242 wave_right = np .asfortranarray (wave [1 ])
4343
44- spec_left = librosa .stft (wave_left , n_fft , hop_length = hop_length )
45- spec_right = librosa .stft (wave_right , n_fft , hop_length = hop_length )
44+ spec_left = librosa .stft (wave_left , n_fft = n_fft , hop_length = hop_length )
45+ spec_right = librosa .stft (wave_right , n_fft = n_fft , hop_length = hop_length )
4646
4747 spec = np .asfortranarray ([spec_left , spec_right ])
4848
@@ -76,7 +76,7 @@ def run_thread(**kwargs):
7676 kwargs = {"y" : wave_left , "n_fft" : n_fft , "hop_length" : hop_length },
7777 )
7878 thread .start ()
79- spec_right = librosa .stft (wave_right , n_fft , hop_length = hop_length )
79+ spec_right = librosa .stft (wave_right , n_fft = n_fft , hop_length = hop_length )
8080 thread .join ()
8181
8282 spec = np .asfortranarray ([spec_left , spec_right ])
@@ -228,26 +228,30 @@ def cache_or_load(mix_path, inst_path, mp):
228228
229229 if d == len (mp .param ["band" ]): # high-end band
230230 X_wave [d ], _ = librosa .load (
231- mix_path , bp ["sr" ], False , dtype = np .float32 , res_type = bp ["res_type" ]
231+ mix_path ,
232+ sr = bp ["sr" ],
233+ mono = False ,
234+ dtype = np .float32 ,
235+ res_type = bp ["res_type" ]
232236 )
233237 y_wave [d ], _ = librosa .load (
234238 inst_path ,
235- bp ["sr" ],
236- False ,
239+ sr = bp ["sr" ],
240+ mono = False ,
237241 dtype = np .float32 ,
238242 res_type = bp ["res_type" ],
239243 )
240244 else : # lower bands
241245 X_wave [d ] = librosa .resample (
242246 X_wave [d + 1 ],
243- mp .param ["band" ][d + 1 ]["sr" ],
244- bp ["sr" ],
247+ orig_sr = mp .param ["band" ][d + 1 ]["sr" ],
248+ target_sr = bp ["sr" ],
245249 res_type = bp ["res_type" ],
246250 )
247251 y_wave [d ] = librosa .resample (
248252 y_wave [d + 1 ],
249- mp .param ["band" ][d + 1 ]["sr" ],
250- bp ["sr" ],
253+ orig_sr = mp .param ["band" ][d + 1 ]["sr" ],
254+ target_sr = bp ["sr" ],
251255 res_type = bp ["res_type" ],
252256 )
253257
@@ -399,8 +403,8 @@ def cmb_spectrogram_to_wave(spec_m, mp, extra_bins_h=None, extra_bins=None):
399403 mp .param ["mid_side_b2" ],
400404 mp .param ["reverse" ],
401405 ),
402- bp ["sr" ],
403- sr ,
406+ orig_sr = bp ["sr" ],
407+ target_sr = sr ,
404408 res_type = "sinc_fastest" ,
405409 )
406410 else : # mid
@@ -417,7 +421,7 @@ def cmb_spectrogram_to_wave(spec_m, mp, extra_bins_h=None, extra_bins=None):
417421 ),
418422 )
419423 # wave = librosa.core.resample(wave2, bp['sr'], sr, res_type="sinc_fastest")
420- wave = librosa .core . resample (wave2 , bp ["sr" ], sr , res_type = "scipy" )
424+ wave = librosa .resample (wave2 , orig_sr = bp ["sr" ], target_sr = sr , res_type = "scipy" )
421425
422426 return wave .T
423427
@@ -504,8 +508,8 @@ def ensembling(a, specs):
504508def stft (wave , nfft , hl ):
505509 wave_left = np .asfortranarray (wave [0 ])
506510 wave_right = np .asfortranarray (wave [1 ])
507- spec_left = librosa .stft (wave_left , nfft , hop_length = hl )
508- spec_right = librosa .stft (wave_right , nfft , hop_length = hl )
511+ spec_left = librosa .stft (wave_left , n_fft = nfft , hop_length = hl )
512+ spec_right = librosa .stft (wave_right , n_fft = nfft , hop_length = hl )
509513 spec = np .asfortranarray ([spec_left , spec_right ])
510514
511515 return spec
0 commit comments