我有几个语音文件,我需要剪切声音文件的某个部分,从 0.21 毫秒到 0.45 毫秒。下面的脚本会选择 0.21 毫秒到 0.45 毫秒之间的声音片段并保存。我想从语音文件中剪切片段,然后在没有它的情况下保存它。我可能应该在“将选择结束移动到最近的零交叉”之后添加另一行并更改“写入选定的声音......”但我不确定如何准确。
form Files
sentence InputDir ./
endform
createDirectory ("output")
Create Strings as file list... list 'inputDir$'*.wav
numberOfFiles = Get number of strings
for ifile to numberOfFiles
select Strings list
fileName$ = Get string... ifile
Read from file... 'inputDir$''fileName$'
sound_name$ = selected$ ("Sound")
select Sound 'sound_name$'
Edit
editor Sound 'sound_name$'
Select... 0.21 0.45
Move start of selection to nearest zero crossing
Move end of selection to nearest zero crossing
Write selected sound to WAV file... ./output/'fileName$'
endeditor
select all
minus Strings list
Remove
endfor
select all
Remove