Merge pull request #375 from zhang-heng/main

fix: 语音切分list文件乱序
This commit is contained in:
RVC-Boss 2024-02-03 20:44:56 +08:00 committed by GitHub
commit 38d0e91bc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -25,7 +25,9 @@ model = AutoModel(model=path_asr, model_revision="v2.0.4",
opt=[]
for name in os.listdir(dir):
file_names = os.listdir(dir)
file_names.sort()
for name in file_names:
try:
text = model.generate(input="%s/%s"%(dir,name))[0]["text"]
opt.append("%s/%s|%s|ZH|%s"%(dir,name,opt_name,text))

View File

@ -35,7 +35,7 @@ def slice(inp,opt_root,threshold,min_length,min_interval,hop_size,max_sil_kept,_
if(tmp_max>1):chunk/=tmp_max
chunk = (chunk / tmp_max * (_max * alpha)) + (1 - alpha) * chunk
wavfile.write(
"%s/%s_%s_%s.wav" % (opt_root, name, start, end),
"%s/%s_%010d_%010d.wav" % (opt_root, name, start, end),
32000,
# chunk.astype(np.float32),
(chunk * 32767).astype(np.int16),