Giter Site home page Giter Site logo

voicegen's Introduction

原神语音查询api

本仓库已迁移至 csust-got下

是什么 & 版权声明

用于配合csust-got项目的api服务端,使用python构建,数据保存在SQLite中。

本项目的数据源来自 mys-voice-genshinGenshinVoice 在此感谢这两个项目。

音色迁移的算法来自 so-vits-svc, 使用此功能即代表你同意了 so-vits-svc 的开源协议,以及相关附加许可。 音色模型需要您自己训练,训练方法请参考 so-vits-svc 相关文档。 TTS来自 Azure 的相关api,如需使用,请在配置文件 config.yaml 中添加您自己的api相关信息。

另,本项目使用的语音素材及文本,版权均归于米哈游所有。本项目仅用于学习交流,除已获取版权方许可者外,禁止使用本项目进行商业用途。

如何用

推荐使用docker安装部署,请保证你的docker版本大于等于19.03.0。

在任一安装有docker的机器上,克隆此仓库,然后运行以下命令:

sudo chmod +x ./start_docker_container.sh
sudo ./start_docker_container.sh

如果一切正常,您将看到docker容器编译成功,并能在 docker ps 的结果中看到一个名为 voice_gen 的容器正在运行, 然后您可以通过 http://localhost:37332 访问本项目。

Api 文档

目前有2个Api,详情如下:

1. 获取语音列表(数据来自米游社

URL request version status
/GetVoice Get 1.0 true
请求参数说明

无参数

返回参数说明
返回参数 参数类型 参数说明
audio string 音频文件url
character string 语音角色
text string 音频文本
topic string 话题
返回示例JSON
{
"audio": "https://raw.githubusercontent.com/CSUSTers/mys-voice-genshin/main/res/audio/%E7%94%B3%E9%B9%A4/a988c557f092e60bc2f2262e1ae99538_8516534833961351507.ogg",
"character": "申鹤",
"text": "他的药草品质很好,为人也随和周到。相比起来,脖子上的小蛇倒是口无遮拦…放心,我没有动手。我还不至于和一条蛇置气。",
"topic": "关于白术…"
}

2. 获取语音列表(数据来自游戏解包

URL request version status
/GetVoice/v2 Get 2.0 true
请求参数说明
请求参数 类型 必填 参数说明 示例
character String false 查询的角色名称 刻晴
topic String false 语音的话题(只有羁绊类的语音才有话题) skill1_03
text String false 语音文本 进不去!怎么想都进不去嘛!
sex Bool false 角色性别,女性为true,男性为 false true
type String false 语音类型,比如羁绊:Fetter;剧情对话:Dialog Dialog
返回参数说明
返回参数 参数类型 参数说明
audioURL string 语音文件url
fileName string 语音文件路径(本地访问用)
language string 语音语言
npcNameCode string 角色在游戏中的代号(不同语言中相同),如“ganyu”
npcNameLocal string 角色的本地化名字,如 “甘雨”
sex bool 角色性别,true为女性,false为男性
text string 语音对应的文本
topic string 语音的话题(只有羁绊类的语音才有话题)
type string 语音类型,比如羁绊:Fetter;剧情对话:Dialog
返回示例JSON
{
"audioURL": "https://api.csu.st/file/VO_gameplay/VO_barbara/vo_barbara_battle_skill1_01.ogg",
"fileName": "Chinese\\VO_gameplay\\VO_barbara\\vo_barbara_battle_skill1_01.wem",
"language": "CHS",
"npcNameCode": "barbara",
"npcNameLocal": "芭芭拉",
"sex": "True",
"text": "我会保护大家!",
"topic": "skill1_01",
"type": "Fetter"
}

3. 生成指定音色的音频( Azure TTS + so-vits-svc )

URL request version status
/GetVoice/v3 Get 3.0 true
请求参数说明
请求参数 类型 必填 参数说明 示例
character String false 角色名称 雷电将军
text String true 将生成的语音文本 你们这些小鬼,还不快快滚开!

注意: 在不传入角色时,将从config.yaml中随机选择一个角色

返回参数说明
返回参数 参数类型 参数说明
voice_url string 语音文件url
character string 角色名称
text string 语音文本
返回示例JSON
{
    "character": "雷电将军",
    "text": "你说得对,但是睿宝是我的宝<mstts:express-as style=\"sad\" styledegree=\"2\"> 快走吧,路上一定要注意安全,早去早回。 </mstts:express-as>\"",
    "voice_url": "https://api-server/fileServer/files/xxxxxyyyy.ogg"
}

4. 从自定义SSML生成音频( Azure TTS + so-vits-svc )

URL request version status
/GetVoice/v4 Get 4.0 true
请求参数说明
请求参数 类型 必填 参数说明 示例
character String false 角色名称 雷电将军
text String true SSML内容 <speak xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="http://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" version="1.0" xml:lang="zh-CN"><voice name="zh-CN-XiaoxuanNeural"><mstts:express-as style="gentle"><prosody rate="+35%" pitch="+10%">你们这些小鬼,还不快快滚开!</prosody></mstts:express-as></voice></speak>

注意: 在不传入角色时,将从config.yaml中随机选择一个角色

返回参数说明
返回参数 参数类型 参数说明
voice_url string 语音文件url
character string 角色名称
text string 语音文本
返回示例JSON
{
    "character": "雷电将军",
    "text": "你说得对,但是睿宝是我的宝<mstts:express-as style=\"sad\" styledegree=\"2\"> 快走吧,路上一定要注意安全,早去早回。 </mstts:express-as>\"",
    "voice_url": "https://api-server/fileServer/files/xxxxxyyyy.ogg"
}

项目结构

├── db/
│   ├── character.db # mys数据
│   ├── genshinVoice.db # 游戏解包数据
│   └── result.json # 来自 w4123/GenshinVoice 项目的数据文件
├── db_utils/
│   └── db_utils.py # 将json导入数据库的工具
├── config.yaml # 配置文件
└── ******** # 其他文件

voicegen's People

Contributors

anthony-hoo avatar rachel030219 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

rachel030219

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.