我是 Python 的新手,但我正在研究它作为 DSP 的编程语言。我录制了一个 wav 文件,并一直尝试使用IPython.display.Audio以下方法播放它:
import IPython.display
from scipy.io import wavfile
rate, s = wavfile.read('h.wav')
IPython.display.Audio(s, rate=rate)
Run Code Online (Sandbox Code Playgroud)
但这会产生以下错误:
struct.error: ushort 格式需要 0 <= number <= 0xffff

我尝试安装 FFmpeg,但没有帮助。