TTS RESTful API得到的base64文件解析问题求助 #2060
-
Hello, request_data = { r = requests.post('http://192.168.1.5:8090/paddlespeech/tts', data=json.dumps(request_data)).json() base64_audio_data = r['result']['audio'] sd.play(audio_data, samplerate=16000, blocking=True)` |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
1、API返回的base64转音频可以参考下述链接对应的函数:https://github.com/PaddlePaddle/PaddleSpeech/blob/develop/paddlespeech/server/bin/paddlespeech_client.py#L84 2、转换wav文件的base64值和API返回的base64不一样 是因为 API返回的base64并不是来源于保存的 wav文件,因为考虑到服务端有可能并不想保存音频的情况。参考下述链接 174~192行:https://github.com/PaddlePaddle/PaddleSpeech/blob/develop/paddlespeech/server/engine/tts/python/tts_engine.py#L174 |
Beta Was this translation helpful? Give feedback.
1、API返回的base64转音频可以参考下述链接对应的函数:https://github.com/PaddlePaddle/PaddleSpeech/blob/develop/paddlespeech/server/bin/paddlespeech_client.py#L84
2、转换wav文件的base64值和API返回的base64不一样 是因为 API返回的base64并不是来源于保存的 wav文件,因为考虑到服务端有可能并不想保存音频的情况。参考下述链接 174~192行:https://github.com/PaddlePaddle/PaddleSpeech/blob/develop/paddlespeech/server/engine/tts/python/tts_engine.py#L174