我正在尝试在python中读取wave文件
from scipy.io import wavfile
fname = "good.wav"
sample_rate, samples = wavfile.read(fname)
但是我收到以下错误消息:
ValueError Traceback (most recent call last)
<ipython-input-4-ae3602287699> in <module>
3 from scipy.io import wavfile
4
----> 5 sample_rate, samples = wavfile.read(fname)
6 frequencies, times, spectrogram = signal.spectrogram(samples, sample_rate)
7
in read(filename, mmap)
234
235 try:
--> 236 file_size, is_big_endian = _read_riff_chunk(fid)
237 fmt_chunk_received = False
238 channels = 1
in _read_riff_chunk(fid)
166 # There are also .wav files with "FFIR" or "XFIR" signatures?
167 raise ValueError("File format {}... not "
--> 168 "understood.".format(repr(str1)))
169
170 # Size of entire file
ValueError: File format b'\x00\x00\x00\x1c'... not understood.
猜猜我需要首先以某种方式将文件转换为其他波形文件,因为它可以正确播放。有人提示如何在Mac上理想地执行此操作。