由于之前使用了librosa.output.write_wav()进行音频处理,需要使用sox来对音频进行格式转换。
编写shell文件并执行:
for file in `ls "C:\Users\Gin\Desktop\电赛\liveopenfile007\liveopenfile007\ML-KWS-for-MCU-TengineLite\speech_commands_v0.02_8K\_background_noise_"`
do
p="C:\Users\Gin\Desktop\电赛\liveopenfile007\liveopenfile007\ML-KWS-for-MCU-TengineLite\speech_commands_v0.02_8K\_background_noise_\"${file}
new="C:\Users\Gin\Desktop\电赛\liveopenfile007\liveopenfile007\ML-KWS-for-MCU-TengineLite\speech_commands_v0.02_8K_correctformat\_background_noise_\"${file}
sox $p -b 16 -e signed-integer $new
done