任意采样率转16K采样率

import os


def OtherTo16bit(Path, data):
    InPath = Path + '\\' + data
    OutPath = os.getcwd() + '\\16home\\' + data.split(".")[0] + ".wav"
    os.system('ffmpeg -i ' + InPath + ' -acodec pcm_s16le ' + OutPath)


# path定义要获取的文件名称的目录(C盘除外)
pwdpath = os.getcwd()

print(pwdpath)

newpath = pwdpath + '\\Audio'

# os.listdir()方法获取文件夹名字,返回数组
file_name_list = os.listdir(newpath)

for x in file_name_list:
    OtherTo16bit(newpath, x)

你可能感兴趣的:(从pyhton到高级人工智能,python)