Skip to content

Commit 1686165

Browse files
tkyajifumiama
authored andcommitted
chore: bump librosa to version 0.10.2
There is a bug in librosa 0.9.1. librosa/librosa#1594 As a result, an error occurs when executing the "Vocals/Accompaniment Separation & Reverberation Removal" function. To address this issue, librosa has been upgraded to version 0.10.2. Additionally, torchcrepe has been upgraded due to its dependency on librosa.
1 parent 04d8abe commit 1686165

File tree

7 files changed

+36
-32
lines changed

7 files changed

+36
-32
lines changed

infer/lib/uvr5_pack/lib_v5/spec_utils.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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):
504508
def 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

infer/modules/uvr5/vr.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,20 @@ def _path_audio_(
6161
(
6262
X_wave[d],
6363
_,
64-
) = librosa.core.load( # 理论上librosa读取可能对某些音频有bug,应该上av读取,但是太麻烦了弃坑
64+
) = librosa.load( # 理论上librosa读取可能对某些音频有bug,应该上ffmpeg读取,但是太麻烦了弃坑
6565
music_file,
66-
bp["sr"],
67-
False,
66+
sr=bp["sr"],
67+
mono=False,
6868
dtype=np.float32,
6969
res_type=bp["res_type"],
7070
)
7171
if X_wave[d].ndim == 1:
7272
X_wave[d] = np.asfortranarray([X_wave[d], X_wave[d]])
7373
else: # lower bands
74-
X_wave[d] = librosa.core.resample(
74+
X_wave[d] = librosa.resample(
7575
X_wave[d + 1],
76-
self.mp.param["band"][d + 1]["sr"],
77-
bp["sr"],
76+
orig_sr=self.mp.param["band"][d + 1]["sr"],
77+
target_sr=bp["sr"],
7878
res_type=bp["res_type"],
7979
)
8080
# Stft of wave source
@@ -231,20 +231,20 @@ def _path_audio_(
231231
(
232232
X_wave[d],
233233
_,
234-
) = librosa.core.load( # 理论上librosa读取可能对某些音频有bug,应该上av读取,但是太麻烦了弃坑
234+
) = librosa.load( # 理论上librosa读取可能对某些音频有bug,应该上ffmpeg读取,但是太麻烦了弃坑
235235
music_file,
236-
bp["sr"],
237-
False,
236+
sr=bp["sr"],
237+
mono=False,
238238
dtype=np.float32,
239239
res_type=bp["res_type"],
240240
)
241241
if X_wave[d].ndim == 1:
242242
X_wave[d] = np.asfortranarray([X_wave[d], X_wave[d]])
243243
else: # lower bands
244-
X_wave[d] = librosa.core.resample(
244+
X_wave[d] = librosa.resample(
245245
X_wave[d + 1],
246-
self.mp.param["band"][d + 1]["sr"],
247-
bp["sr"],
246+
orig_sr=self.mp.param["band"][d + 1]["sr"],
247+
target_sr=bp["sr"],
248248
res_type=bp["res_type"],
249249
)
250250
# Stft of wave source

requirements/amd.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ joblib>=1.1.0
33
numba==0.56.4
44
numpy==1.23.5
55
scipy
6-
librosa==0.9.1
6+
librosa==0.10.2
77
llvmlite==0.39.0
88
fairseq==0.12.2
99
faiss-cpu==1.7.3

requirements/dml.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ joblib>=1.1.0
22
numba==0.56.4
33
numpy==1.23.5
44
scipy
5-
librosa==0.9.1
5+
librosa==0.10.2
66
llvmlite==0.39.0
77
fairseq==0.12.2
88
faiss-cpu==1.7.3

requirements/ipex.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ joblib>=1.1.0
77
numba==0.56.4
88
numpy==1.23.5
99
scipy
10-
librosa==0.9.1
10+
librosa==0.10.2
1111
llvmlite==0.39.0
1212
fairseq==0.12.2
1313
faiss-cpu==1.7.3

requirements/main.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ joblib>=1.1.0
22
numba
33
numpy==1.23.5
44
scipy
5-
librosa==0.9.1
5+
librosa==0.10.2
66
llvmlite
77
fairseq
88
faiss-cpu

requirements/py311.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ joblib>=1.1.0
22
numba
33
numpy
44
scipy
5-
librosa==0.9.1
5+
librosa==0.10.2
66
llvmlite
77
fairseq @ git+https://github.com/One-sixth/fairseq.git
88
faiss-cpu

0 commit comments

Comments
 (0)