我正在使用enhanced wavfile.py library,并且我想用它来读取serum-style波表。我知道这些文件使用“clm”块来存储提示点,但是我在使用库阅读这些文件时遇到了问题
现在我只是尝试读取文件(稍后我将对它做一些事情);下面是我代码:
import wavfile as wf
wf.read('wavetable.wav')
当我运行脚本时,我收到以下错误:
[my dir]/wavfile.py:223: WavFileWarning: Chunk b'clm ' skipped
warnings.warn("Chunk " + str(chunk_id) + " skipped", WavFileWarning)
[my dir]/wavfile.py:223: WavFileWarning: Chunk b'' skipped
warnings.warn("Chunk " + str(chunk_id) + " skipped", WavFileWarning)
Traceback (most recent call last):
File "[my dir]/./test.py", line 5, in <module>
wf.read('wavetable.wav')
File "[my dir]/wavfile.py", line 228, in read
_skip_unknown_chunk(fid)
File "[my dir]/wavfile.py", line 112, in _skip_unknown_chunk
size = struct.unpack('<i', data)[0]
struct.error: unpack requires a buffer of 4 bytes
使用库是否有可能做到这一点?如果没有,我如何修改库以使其工作?
请耐心听我说,我对使用文件和python还不熟悉
最新消息:
下面是添加麦迪逊courto的代码后的输出:
Traceback (most recent call last):
File "[my dir]/./test.py", line 5, in <module>
wf.debug('wavetable.wav')
File "[my dir]/wavfile.py", line 419, in debug
format_str = format.decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 1: invalid start byte
here是我测试的波表希望sndup没动它
1条答案
按热度按时间tf7tbtn21#
在read函数中添加这些条件会返回一个dict的标记,看起来其中一个标记是currupt,所以我添加了except pass,这有点麻烦,但是可以工作。