返回> 网站首页 

onnx语音模型

yoours2026-09-01 19:42:03 阅读 22

简介一边听听音乐,一边写写文章。

一、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"

    3. 仅支持wav格式
        ffmpeg -i abc.mp3 abc1.wav

三、模型下载
 1. 镜像下载hfd
    wget https://hf-mirror.com/hfd/hfd.sh
    chmod a+x hfd.sh

2. 设置环境变量
    Linux
        export HF_ENDPOINT=https://hf-mirror.com
    Windows Powershell
        $env:HF_ENDPOINT = "https://hf-mirror.com"

3. 下载模型
    ./hfd.sh download rhasspy/piper-voices --include "zh/*"
    ./hfd.sh rhasspy/piper-voices --include "zh/*"

四、msys64环境
1. 首先,更新包数据库(建议):
    pacman -Syu

2. msys安装缺少的库
    pacman -S mingw64/mingw-w64-x86_64-aria2

3.安装 curl:
    pacman -S curl
    pacman -S jq

4. 安装 64位 curl 包(推荐,功能更全):
    pacman -S mingw-w64-x86_64-curl

微信小程序扫码登陆

文章评论

22人参与,0条评论