返回> 网站首页
onnx语音模型
yoours2026-09-01 19:42:03
简介一边听听音乐,一边写写文章。
一、TTS
1. 开源地址
https://github.com/OHF-Voice/piper1-gpl
使用CMake-gui创建编译环境,编译libpiper库和piper示例。
2. 测试命令:
piper_exe.exe --model E:\piper-voices\zh\zh_CN\huayan\medium\zh_CN-huayan-medium.onnx --output_file 1.wav --espeak-data E:\_piper1-gpl-main\libpiper\build\espeak_ng-install\share\espeak-ng-data
注:程序中注释掉关于 while (getline(std::cin, line)) 的部分,并定义中文字符串,且进行utf8转换。
如:std::string line = GB2312ToUTF8(“”“”) 其他格式不识别。
std::ofstream audioFile(outputPath.string(), std::ios::binary);
textToWavFile(piper, &local_options, line.c_str(), audioFile);
二、ASR
1. 开源地址
https://www.modelscope.cn/models/xiaowangge/sherpa-onnx-sense-voice-small/files
https://github.com/k2-fsa/sherpa-onnx
2. 测试命令
1. 启动http服务
py http_ws_server.py
2. 客户端请求
curl -X POST "http://127.0.0.1:7998/v1/stt" -H "Authorization: Bearer d01a4f4d-4746-4e75-9bf0-efa8974c9ded" -F "file=@morning_scene.wav"