Add full support of all samplerate. (#182)

Co-authored-by: EntropyRiser <1832783120@qq.com>
This commit is contained in:
EntropyRiser 2023-04-27 18:52:01 +08:00 committed by GitHub
parent 80b54499eb
commit a149107c5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

8
gui.py
View File

@ -52,7 +52,7 @@ class RVC:
self.model = self.model.half()
self.model.eval()
cpt = torch.load(pth_path, map_location="cpu")
tgt_sr = cpt["config"][-1]
self.tgt_sr = cpt["config"][-1]
cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk
self.if_f0 = cpt.get("f0", 1)
if self.if_f0 == 1:
@ -374,10 +374,10 @@ class GUI:
self.block_frame = int(self.config.block_time * self.config.samplerate)
self.crossfade_frame = int(self.config.crossfade_time * self.config.samplerate)
self.sola_search_frame = int(0.012 * self.config.samplerate)
self.delay_frame = int(0.02 * self.config.samplerate) # 往前预留0.02s
self.delay_frame = int(0.01 * self.config.samplerate) # 往前预留0.02s
self.extra_frame = int(
self.config.extra_time * self.config.samplerate
) # 往后预留0.04s
)
self.rvc = None
self.rvc = RVC(
self.config.pitch,
@ -408,7 +408,7 @@ class GUI:
orig_freq=self.config.samplerate, new_freq=16000, dtype=torch.float32
)
self.resampler2 = tat.Resample(
orig_freq=40000, new_freq=self.config.samplerate, dtype=torch.float32
orig_freq=self.rvc.tgt_sr, new_freq=self.config.samplerate, dtype=torch.float32
)
thread_vc = threading.Thread(target=self.soundinput)
thread_vc.start()