sample = r"C:\Users\Administrator\Desktop\aws-3 "
files = os.listdir(sample)
files = [sample + "\\" + f for f in files if f.endswith('.wav')]
num = len(files)
threshold_value = 1
check_repeat = []
for i in xrange(num):
song = djv.recognize(FileRecognizer, files[i])
FileName = files[i]
# print("recognition File Name is ", FileName)
f = wave.open(FileName, "rb")
params = f.getparams()
# print(params)
nchannels, sampwidth, framerate, nframes = params[:4]
str_data = f.readframes(nframes)
f.close()
wave_data = np.fromstring(str_data, dtype=np.short)
wave_data = wave_data.astype(np.short)
print "测试数据", i + 1, ":", os.path.basename(files[i]), "From file we recognized: %s" % song
try:
if song['confidence'] > threshold_value:
# print "可能重复文件", i + 1, ":", os.path.basen
Python对批量wav文件改名
最新推荐文章于 2024-01-08 14:53:22 发布
本文介绍如何使用Python脚本批量修改wav音频文件的名称,详细讲解了相关代码实现,帮助用户高效管理音频文件。
摘要由CSDN通过智能技术生成