参考:
https://huggingface.co/suno/bark
1、录制、保存
参考:
https://blog.csdn.net/weixin_42357472/article/details/131269539(ffmpeg也可以录制)
下面使用的sounddevice包录制
import scipy
sampling_rate = model.config.sample_rate
scipy.io.wavfile.write("bark_out.wav", rate=sampling_rate, data=speech_values.cpu().numpy().squeeze())
2、播放
from IPython.display import Audio
sampling_rate = model.generation_config.sample_rate
Audio(speech_values.cpu().numpy().squeeze(), rate=sampling_rate)