2024-10-02 12:22:52 发布
网友
我正在尝试使用wave模块编辑wav文件的长度。然而,我似乎哪儿也去不了,因为我一直得到同样的错误,即通道数没有指定。尽管如此,当我写一些东西来查看通道数量时,我仍然会得到这个错误,或者当我试图设置通道数量时,如下所示:
def editLength(wavFile): file = wave.open(wavFile, 'w') file.setnchannels(file.getnchannels()) x = file.getnchannels() print (x)
来自https://docs.python.org/3.7/library/wave.html#wave.open
wave.open(file, mode=None) If file is a string, open the file by that name, otherwise treat it as a file-like object. mode can be: 'rb' Read only mode. 'wb' Write only mode. Note that it does not allow read/write WAV files.
试图从WAV文件读写时,file对象在第一个file.getnchannels()时没有指定通道数。在
file.getnchannels()
如果要编辑文件,应首先从原始文件读取并写入临时文件。然后将临时文件复制到原始文件上。在
来自https://docs.python.org/3.7/library/wave.html#wave.open
试图从WAV文件读写时,file对象在第一个
^{pr2}$file.getnchannels()
时没有指定通道数。在如果要编辑文件,应首先从原始文件读取并写入临时文件。然后将临时文件复制到原始文件上。在
相关问题 更多 >
编程相关推荐