From fc218079eadca37722be27d712fa38260181b009 Mon Sep 17 00:00:00 2001 From: zhangheng Date: Sat, 3 Feb 2024 15:43:15 +0800 Subject: [PATCH 1/2] Update cmd-asr.py slice files order by name --- tools/damo_asr/cmd-asr.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/damo_asr/cmd-asr.py b/tools/damo_asr/cmd-asr.py index 9a10797..9840e91 100644 --- a/tools/damo_asr/cmd-asr.py +++ b/tools/damo_asr/cmd-asr.py @@ -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)) From 6410628a5fd17380b5c3bc91750508daccc1184c Mon Sep 17 00:00:00 2001 From: zhangheng Date: Sat, 3 Feb 2024 15:44:09 +0800 Subject: [PATCH 2/2] Update slice_audio.py audio slice files name format. --- tools/slice_audio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/slice_audio.py b/tools/slice_audio.py index 4c0e270..46ee408 100644 --- a/tools/slice_audio.py +++ b/tools/slice_audio.py @@ -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),