https://github.com/easychen/xf-tts-sdk
php & node sdk for xunfei tts websocket api
https://github.com/easychen/xf-tts-sdk
Last synced: 8 months ago
JSON representation
php & node sdk for xunfei tts websocket api
- Host: GitHub
- URL: https://github.com/easychen/xf-tts-sdk
- Owner: easychen
- License: mit
- Created: 2019-10-02T11:49:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-12T01:56:47.000Z (over 6 years ago)
- Last Synced: 2025-04-05T20:11:15.067Z (about 1 year ago)
- Language: JavaScript
- Size: 43 KB
- Stars: 10
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 讯飞 TTS 流式接口非官方 SDK 和 Demo
## 说明
讯飞的新TTS接口采用了 websocket 协议。新协议其实比较简单,就是添加了一个鉴权算法来生成 ws 的连接URL。另外约定了发送数据的JSON格式。
官方文档地址:https://www.xfyun.cn/doc/tts/online_tts/API.html
这里分别给出 PHP 和 Node 下计算连接用URL的函数和发送消息的包装函数。以及相应的Demo。
## PHP 版
见 php/demo.php
- get_xf_wss_info
- text2sendjson
注意:
- 需要安装 swoole 扩展 4.4+
- 需要 `composer install` 后在运行 `php demo.php`
## Nodejs 版
见 node/demo.js
- btoa
- get_wss_info
- text2json