Skip to content

Commit a149107

Browse files
EntropyRiserEntropyRiser
andauthored
Add full support of all samplerate. (#182)
Co-authored-by: EntropyRiser <1832783120@qq.com>
1 parent 80b5449 commit a149107

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gui.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(
5252
self.model = self.model.half()
5353
self.model.eval()
5454
cpt = torch.load(pth_path, map_location="cpu")
55-
tgt_sr = cpt["config"][-1]
55+
self.tgt_sr = cpt["config"][-1]
5656
cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk
5757
self.if_f0 = cpt.get("f0", 1)
5858
if self.if_f0 == 1:
@@ -374,10 +374,10 @@ def start_vc(self):
374374
self.block_frame = int(self.config.block_time * self.config.samplerate)
375375
self.crossfade_frame = int(self.config.crossfade_time * self.config.samplerate)
376376
self.sola_search_frame = int(0.012 * self.config.samplerate)
377-
self.delay_frame = int(0.02 * self.config.samplerate) # 往前预留0.02s
377+
self.delay_frame = int(0.01 * self.config.samplerate) # 往前预留0.02s
378378
self.extra_frame = int(
379379
self.config.extra_time * self.config.samplerate
380-
) # 往后预留0.04s
380+
)
381381
self.rvc = None
382382
self.rvc = RVC(
383383
self.config.pitch,
@@ -408,7 +408,7 @@ def start_vc(self):
408408
orig_freq=self.config.samplerate, new_freq=16000, dtype=torch.float32
409409
)
410410
self.resampler2 = tat.Resample(
411-
orig_freq=40000, new_freq=self.config.samplerate, dtype=torch.float32
411+
orig_freq=self.rvc.tgt_sr, new_freq=self.config.samplerate, dtype=torch.float32
412412
)
413413
thread_vc = threading.Thread(target=self.soundinput)
414414
thread_vc.start()

0 commit comments

Comments
 (0)