https://github.com/lfbear/tools
small tool
https://github.com/lfbear/tools
Last synced: about 1 year ago
JSON representation
small tool
- Host: GitHub
- URL: https://github.com/lfbear/tools
- Owner: lfbear
- Created: 2017-04-27T09:52:59.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-27T10:10:20.000Z (about 9 years ago)
- Last Synced: 2025-02-17T05:56:52.018Z (over 1 year ago)
- Language: Python
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# small tools
+ [Baidu Voice API](/baidu_tools.py) (百度语音服务rest api调用封装)
A single python script (depend on python libs: requests, base64, json, os)
- Voice to Text (语音识别服务)
```
api = baiduYuyin(API_KEY,API_SECRET) # you can get key and secret at http://yuyin.baidu.com/, it's free
words = api.sound2text('./test.wav') # words is a list, failed if words is empty
# special for test.wav, it must be a wav file, 8kHZ and 16bit
# I get wav file by this cmd: arecord -D "plughw:CARD=Device" -d 5 -r 8000 -t wav -f S16_LE test.wav
```
- Text to Voice (语音合成服务)
```
api = baiduYuyin(API_KEY,API_SECRET)
api.text2sound(output_msg,file_name); # output_msg is a list, file_name is a mp3 file that voice will storage
```