我想转换一些wav 48kHz 24位文件.wav至48kHz 16位文件-2.wav
import wave
origAudio = wave.open("Sample_5073.wav","r")
frameRate = origAudio.getframerate()
nChannels = origAudio.getnchannels()
sampWidth = origAudio.getsampwidth()
nbframe=origAudio.getnframes()
da = np.fromstring(origAudio.readframes(48000), dtype=np.int16)
left, right = da[0::2], da[1::2]
谢谢
如果您只想将文件从24位转换为16位,那么您可以使用SoX,这不会比这简单得多:
SoX还可以做更多的事情,只需看看它的man page。在
如果您想使用Python,我建议使用soundfile模块:
^{pr2}$指定
subtype='PCM_16'
甚至不是绝对必要的,因为它是默认值。在如果您真的想用内置的} module 。在
ẁave
模块来做,请看一下我的tutorial about the ^{相关问题 更多 >
编程相关推荐