feat: 支持调节vits的一些参数

This commit is contained in:
ikechan8370 2023-03-04 20:54:26 +08:00
parent 59bec4e22a
commit 41ca23dc85
3 changed files with 34 additions and 1 deletions

View file

@ -298,6 +298,36 @@ export function supportGuoba () {
label: '语音转换API地址',
bottomHelpMessage: '前往duplicate空间https://huggingface.co/spaces/ikechan8370/vits-uma-genshin-honkai后查看api地址',
component: 'Input'
},
{
field: 'noiseScale',
label: 'noiseScale',
bottomHelpMessage: '控制情感变化程度',
component: 'InputNumber',
componentProps: {
min: 0,
max: 1
}
},
{
field: 'noiseScaleW',
label: 'noiseScaleW',
bottomHelpMessage: '控制音素发音长度',
component: 'InputNumber',
componentProps: {
min: 0,
max: 1
}
},
{
field: 'lengthScale',
label: 'lengthScale',
bottomHelpMessage: '控制整体语速',
component: 'InputNumber',
componentProps: {
min: 0,
max: 2
}
}
],
// 获取配置数据方法(用于前端填充显示数据)

View file

@ -40,6 +40,9 @@ const defaultConfig = {
defaultTimeoutMs: 120000,
chromeTimeoutMS: 120000,
ttsSpace: '',
noiseScale: 0.6,
noiseScaleW: 0.668,
lengthScale: 1.2,
version: 'v2.0.17'
}
const _path = process.cwd()

View file

@ -24,7 +24,7 @@ const newFetch = (url, options = {}) => {
return fetch(url, mergedOptions)
}
const space = Config.ttsSpace
export async function generateAudio (text, speaker = '琪亚娜', language = '中文', noiseScale = 0.6, noiseScaleW = 0.668, lengthScale = 1.2) {
export async function generateAudio (text, speaker = '琪亚娜', language = '中文', noiseScale = Config.noiseScale, noiseScaleW = Config.noiseScaleW, lengthScale = Config.lengthScale) {
logger.info(`正在使用${speaker},基于文本:'${text}'生成语音`)
let body = {
data: [