测试使用 suno 的时候:
https://huggingface.co/suno/bark-small
报错
Traceback (most recent call last):File "<stdin>", line 1, in <module>File "/Users/xx/miniconda3/lib/python3.11/site-packages/scipy/io/wavfile.py", line 824, in writefmt_chunk_data = struct.pack('<HHIIHH', format_tag, channels, fs,^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: ushort format requires 0 <= number <= 65535
查看发现 issue :scipy.io.wavefile.write ouputs incorrect error
https://github.com/scipy/scipy/issues/5766
将保存的音频数据添加 .ravel()
暂时解决了这个问题
即:
scipy.io.wavfile.write(save_path, rate=speech["sampling_rate"], data=speech["audio"] )
改为
scipy.io.wavfile.write(save_path, rate=speech["sampling_rate"], data=speech["audio"].ravel() )
2024-11-11(六)