2020
09-23
09-23
Python对wav文件的重采样实例
例如从2channel,4.41khz重采样到1channel,16khzdefdownsampleWav(src,dst,inrate=44100,outrate=16000,inchannels=2,outchannels=1):importos,wave,audioopifnotos.path.exists(src):print('Sourcenotfound!')returnFalseifnotos.path.exists(os.path.dirname(dst)):os.makedirs(os.path.dirname(dst))try:s_read=wave.open(src,'r')s_write=wave.open(dst,'w')except:print('Fai...
继续阅读 >