support protect
This commit is contained in:
commit
8685f9e5bf
@ -175,11 +175,11 @@
|
|||||||
"options": {}
|
"options": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "rvcQuality",
|
"name": "silenceFront",
|
||||||
"options": {}
|
"options": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "silenceFront",
|
"name": "protect",
|
||||||
"options": {}
|
"options": {}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
11
client/demo/dist/index.html
vendored
11
client/demo/dist/index.html
vendored
@ -1,10 +1 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html><html style="width:100%;height:100%;overflow:hidden"><head><meta charset="utf-8"/><title>Voice Changer Client Demo</title><script defer="defer" src="index.js"></script></head><body style="width:100%;height:100%;margin:0"><div id="app" style="width:100%;height:100%"></div></body></html>
|
||||||
<html style="width: 100%; height: 100%; overflow: hidden">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<title>Voice Changer Client Demo</title>
|
|
||||||
<script defer src="index.js"></script></head>
|
|
||||||
<body style="width: 100%; height: 100%; margin: 0px">
|
|
||||||
<div id="app" style="width: 100%; height: 100%"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
1728
client/demo/dist/index.js
vendored
1728
client/demo/dist/index.js
vendored
File diff suppressed because one or more lines are too long
31
client/demo/dist/index.js.LICENSE.txt
vendored
Normal file
31
client/demo/dist/index.js.LICENSE.txt
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @license React
|
||||||
|
* react-dom.production.min.js
|
||||||
|
*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @license React
|
||||||
|
* react.production.min.js
|
||||||
|
*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @license React
|
||||||
|
* scheduler.production.min.js
|
||||||
|
*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
2346
client/demo/package-lock.json
generated
2346
client/demo/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -19,18 +19,18 @@
|
|||||||
"author": "wataru.okada@flect.co.jp",
|
"author": "wataru.okada@flect.co.jp",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.22.0",
|
"@babel/core": "^7.22.1",
|
||||||
"@babel/plugin-transform-runtime": "^7.22.0",
|
"@babel/plugin-transform-runtime": "^7.22.4",
|
||||||
"@babel/preset-env": "^7.22.0",
|
"@babel/preset-env": "^7.22.4",
|
||||||
"@babel/preset-react": "^7.22.0",
|
"@babel/preset-react": "^7.22.3",
|
||||||
"@babel/preset-typescript": "^7.21.5",
|
"@babel/preset-typescript": "^7.21.5",
|
||||||
"@types/node": "^20.2.4",
|
"@types/node": "^20.2.5",
|
||||||
"@types/react": "^18.2.7",
|
"@types/react": "^18.2.7",
|
||||||
"@types/react-dom": "^18.2.4",
|
"@types/react-dom": "^18.2.4",
|
||||||
"autoprefixer": "^10.4.14",
|
"autoprefixer": "^10.4.14",
|
||||||
"babel-loader": "^9.1.2",
|
"babel-loader": "^9.1.2",
|
||||||
"copy-webpack-plugin": "^11.0.0",
|
"copy-webpack-plugin": "^11.0.0",
|
||||||
"css-loader": "^6.7.4",
|
"css-loader": "^6.8.1",
|
||||||
"eslint": "^8.41.0",
|
"eslint": "^8.41.0",
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
@ -39,7 +39,7 @@
|
|||||||
"html-loader": "^4.2.0",
|
"html-loader": "^4.2.0",
|
||||||
"html-webpack-plugin": "^5.5.1",
|
"html-webpack-plugin": "^5.5.1",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"postcss-loader": "^7.3.1",
|
"postcss-loader": "^7.3.2",
|
||||||
"postcss-nested": "^6.0.1",
|
"postcss-nested": "^6.0.1",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^2.8.8",
|
||||||
"rimraf": "^5.0.1",
|
"rimraf": "^5.0.1",
|
||||||
@ -47,12 +47,12 @@
|
|||||||
"ts-loader": "^9.4.3",
|
"ts-loader": "^9.4.3",
|
||||||
"tsconfig-paths": "^4.2.0",
|
"tsconfig-paths": "^4.2.0",
|
||||||
"typescript": "^5.0.4",
|
"typescript": "^5.0.4",
|
||||||
"webpack": "^5.84.1",
|
"webpack": "^5.85.0",
|
||||||
"webpack-cli": "^5.1.1",
|
"webpack-cli": "^5.1.1",
|
||||||
"webpack-dev-server": "^4.15.0"
|
"webpack-dev-server": "^4.15.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dannadori/voice-changer-client-js": "^1.0.135",
|
"@dannadori/voice-changer-client-js": "^1.0.138",
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
||||||
"@fortawesome/free-brands-svg-icons": "^6.4.0",
|
"@fortawesome/free-brands-svg-icons": "^6.4.0",
|
||||||
"@fortawesome/free-regular-svg-icons": "^6.4.0",
|
"@fortawesome/free-regular-svg-icons": "^6.4.0",
|
||||||
|
@ -175,11 +175,11 @@
|
|||||||
"options": {}
|
"options": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "rvcQuality",
|
"name": "silenceFront",
|
||||||
"options": {}
|
"options": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "silenceFront",
|
"name": "protect",
|
||||||
"options": {}
|
"options": {}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -32,7 +32,6 @@ import { CrossFadeOffsetRateRow, CrossFadeOffsetRateRowProps } from "./component
|
|||||||
import { CrossFadeEndRateRow, CrossFadeEndRateRowProps } from "./components/807_CrossFadeEndRateRow"
|
import { CrossFadeEndRateRow, CrossFadeEndRateRowProps } from "./components/807_CrossFadeEndRateRow"
|
||||||
import { DownSamplingModeRow, DownSamplingModeRowProps } from "./components/808_DownSamplingModeRow"
|
import { DownSamplingModeRow, DownSamplingModeRowProps } from "./components/808_DownSamplingModeRow"
|
||||||
import { TrancateNumTresholdRow, TrancateNumTresholdRowProps } from "./components/809_TrancateNumTresholdRow"
|
import { TrancateNumTresholdRow, TrancateNumTresholdRowProps } from "./components/809_TrancateNumTresholdRow"
|
||||||
import { IndexRatioRow, IndexRatioRowProps } from "./components/609_IndexRatioRow"
|
|
||||||
import { RVCQualityRow, RVCQualityRowProps } from "./components/810_RVCQualityRow"
|
import { RVCQualityRow, RVCQualityRowProps } from "./components/810_RVCQualityRow"
|
||||||
import { ModelSamplingRateRow, ModelSamplingRateRowProps } from "./components/303_ModelSamplingRateRow"
|
import { ModelSamplingRateRow, ModelSamplingRateRowProps } from "./components/303_ModelSamplingRateRow"
|
||||||
import { DstIdRow2, DstIdRow2Props } from "./components/602v2_DstIdRow2"
|
import { DstIdRow2, DstIdRow2Props } from "./components/602v2_DstIdRow2"
|
||||||
@ -56,6 +55,8 @@ import { DiffMethodRow, DiffMethodRowProps } from "./components/613_DiffMethodRo
|
|||||||
import { ServerOpertationRow, ServerOpertationRowProps } from "./components/207_ServerOpertationRow"
|
import { ServerOpertationRow, ServerOpertationRowProps } from "./components/207_ServerOpertationRow"
|
||||||
import { SampleModelSelectRow, SampleModelSelectRowProps } from "./components/301-j_SampleModelSelectRow"
|
import { SampleModelSelectRow, SampleModelSelectRowProps } from "./components/301-j_SampleModelSelectRow"
|
||||||
import { SampleDownloadControlRow, SampleDownloadControlRowProps } from "./components/301-k_SampleDownloadControl"
|
import { SampleDownloadControlRow, SampleDownloadControlRowProps } from "./components/301-k_SampleDownloadControl"
|
||||||
|
import { IndexRatioRow, IndexRatioRowProps } from "./components/609_IndexRatioRow copy"
|
||||||
|
import { ProtectRow, ProtectRowProps } from "./components/610_ProtectRow"
|
||||||
|
|
||||||
export const catalog: { [key: string]: (props: any) => JSX.Element } = {}
|
export const catalog: { [key: string]: (props: any) => JSX.Element } = {}
|
||||||
|
|
||||||
@ -122,6 +123,7 @@ const initialize = () => {
|
|||||||
addToCatalog("noiseScale", (props: NoiseScaleRowProps) => { return <NoiseScaleRow {...props} /> })
|
addToCatalog("noiseScale", (props: NoiseScaleRowProps) => { return <NoiseScaleRow {...props} /> })
|
||||||
addToCatalog("silentThreshold", (props: SilentThresholdRowProps) => { return <SilentThresholdRow {...props} /> })
|
addToCatalog("silentThreshold", (props: SilentThresholdRowProps) => { return <SilentThresholdRow {...props} /> })
|
||||||
addToCatalog("indexRatio", (props: IndexRatioRowProps) => { return <IndexRatioRow {...props} /> })
|
addToCatalog("indexRatio", (props: IndexRatioRowProps) => { return <IndexRatioRow {...props} /> })
|
||||||
|
addToCatalog("protect", (props: ProtectRowProps) => { return <ProtectRow {...props} /> })
|
||||||
addToCatalog("diffEnabler", (props: DiffEnablerRowProps) => { return <DiffEnablerRow {...props} /> })
|
addToCatalog("diffEnabler", (props: DiffEnablerRowProps) => { return <DiffEnablerRow {...props} /> })
|
||||||
addToCatalog("diffSetting", (props: DiffSettingRowProps) => { return <DiffSettingRow {...props} /> })
|
addToCatalog("diffSetting", (props: DiffSettingRowProps) => { return <DiffSettingRow {...props} /> })
|
||||||
addToCatalog("diffMethod", (props: DiffMethodRowProps) => { return <DiffMethodRow {...props} /> })
|
addToCatalog("diffMethod", (props: DiffMethodRowProps) => { return <DiffMethodRow {...props} /> })
|
||||||
|
@ -77,7 +77,7 @@ export const StartingNoticeDialog = () => {
|
|||||||
const content = (
|
const content = (
|
||||||
<div className="body-row">
|
<div className="body-row">
|
||||||
{lang != "ja" || edition.indexOf("onnxdirectML-cuda") >= 0 ? donationMessage : <></>}
|
{lang != "ja" || edition.indexOf("onnxdirectML-cuda") >= 0 ? donationMessage : <></>}
|
||||||
{lang != "ja" || edition.indexOf("onnxdirectML-cuda") >= 0 ? directMLMessage : <></>}
|
{edition.indexOf("onnxdirectML-cuda") >= 0 ? directMLMessage : <></>}
|
||||||
{clickToStartMessage}
|
{clickToStartMessage}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -24,7 +24,10 @@ export const ModelSwitchRow = (_props: ModelSwitchRowProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const options = appState.serverSetting.serverSetting.modelSlots.map((x, index) => {
|
const modelSlots = appState.serverSetting.serverSetting.modelSlots
|
||||||
|
let options: React.JSX.Element[] = []
|
||||||
|
if (modelSlots) {
|
||||||
|
options = modelSlots.map((x, index) => {
|
||||||
let filename = ""
|
let filename = ""
|
||||||
if (x.modelFile && x.modelFile.length > 0) {
|
if (x.modelFile && x.modelFile.length > 0) {
|
||||||
filename = x.modelFile.replace(/^.*[\\\/]/, '')
|
filename = x.modelFile.replace(/^.*[\\\/]/, '')
|
||||||
@ -53,16 +56,18 @@ export const ModelSwitchRow = (_props: ModelSwitchRowProps) => {
|
|||||||
const tuning = `t:${x.defaultTune}`
|
const tuning = `t:${x.defaultTune}`
|
||||||
const useIndex = x.indexFile != null ? `i:true` : `i:false`
|
const useIndex = x.indexFile != null ? `i:true` : `i:false`
|
||||||
const defaultIndexRatio = `ir:${x.defaultIndexRatio}`
|
const defaultIndexRatio = `ir:${x.defaultIndexRatio}`
|
||||||
const subMetadata = `(${tuning},${useIndex},${defaultIndexRatio})`
|
const defaultProtect = `p:${x.defaultProtect}`
|
||||||
|
const subMetadata = `(${tuning},${useIndex},${defaultIndexRatio},${defaultProtect})`
|
||||||
const displayName = `${metadata} ${x.name || filename} ${subMetadata}`
|
const displayName = `${metadata} ${x.name || filename} ${subMetadata}`
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<option key={index} value={index}>{displayName}</option>
|
<option key={index} value={index}>{displayName}</option>
|
||||||
)
|
)
|
||||||
}).filter(x => { return x != null })
|
}).filter(x => { return x != null }) as React.JSX.Element[]
|
||||||
|
}
|
||||||
|
|
||||||
const selectedTermOfUseUrl = appState.serverSetting.serverSetting.modelSlots[slot]?.termsOfUseUrl || null
|
const selectedTermOfUseUrl = modelSlots ? modelSlots[slot]?.termsOfUseUrl || null : null
|
||||||
const selectedTermOfUseUrlLink = selectedTermOfUseUrl ? <a href={selectedTermOfUseUrl} target="_blank" rel="noopener noreferrer" className="body-item-text-small">[terms of use]</a> : <></>
|
const selectedTermOfUseUrlLink = selectedTermOfUseUrl ? <a href={selectedTermOfUseUrl} target="_blank" rel="noopener noreferrer" className="body-item-text-small">[terms of use]</a> : <></>
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
import React, { useMemo } from "react"
|
||||||
|
import { useAppState } from "../../../001_provider/001_AppStateProvider"
|
||||||
|
|
||||||
|
export type ProtectRowProps = {
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ProtectRow = (_props: ProtectRowProps) => {
|
||||||
|
const appState = useAppState()
|
||||||
|
|
||||||
|
const clusterRatioRow = useMemo(() => {
|
||||||
|
return (
|
||||||
|
<div className="body-row split-3-3-4 left-padding-1 guided">
|
||||||
|
<div className="body-item-title left-padding-1 ">protect</div>
|
||||||
|
<div>
|
||||||
|
<input type="range" className="body-item-input-slider" min="0" max="0.5" step="0.1" value={appState.serverSetting.serverSetting.protect || 0} onChange={(e) => {
|
||||||
|
appState.serverSetting.updateServerSettings({ ...appState.serverSetting.serverSetting, protect: Number(e.target.value) })
|
||||||
|
}}></input>
|
||||||
|
<span className="body-item-input-slider-val">{appState.serverSetting.serverSetting.protect}</span>
|
||||||
|
</div>
|
||||||
|
<div className="body-button-container">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}, [
|
||||||
|
appState.serverSetting.serverSetting,
|
||||||
|
appState.serverSetting.updateServerSettings
|
||||||
|
])
|
||||||
|
|
||||||
|
return clusterRatioRow
|
||||||
|
}
|
@ -15,6 +15,9 @@ export const MergeLabRow = (_props: MergeLabRowProps) => {
|
|||||||
|
|
||||||
// スロットが変更されたときの初期化処理
|
// スロットが変更されたときの初期化処理
|
||||||
const newSlotChangeKey = useMemo(() => {
|
const newSlotChangeKey = useMemo(() => {
|
||||||
|
if (!appState.serverSetting.serverSetting.modelSlots) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
return appState.serverSetting.serverSetting.modelSlots.reduce((prev, cur) => {
|
return appState.serverSetting.serverSetting.modelSlots.reduce((prev, cur) => {
|
||||||
return prev + "_" + cur.modelFile
|
return prev + "_" + cur.modelFile
|
||||||
}, "")
|
}, "")
|
||||||
@ -50,6 +53,7 @@ export const MergeLabRow = (_props: MergeLabRowProps) => {
|
|||||||
command: "mix",
|
command: "mix",
|
||||||
defaultTune: defaultTune,
|
defaultTune: defaultTune,
|
||||||
defaultIndexRatio: 1,
|
defaultIndexRatio: 1,
|
||||||
|
defaultProtect: 0.5,
|
||||||
files: mergeElements
|
files: mergeElements
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
1540
client/lib/package-lock.json
generated
1540
client/lib/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dannadori/voice-changer-client-js",
|
"name": "@dannadori/voice-changer-client-js",
|
||||||
"version": "1.0.136",
|
"version": "1.0.138",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
@ -27,7 +27,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/audioworklet": "^0.0.46",
|
"@types/audioworklet": "^0.0.46",
|
||||||
"@types/node": "^20.2.4",
|
"@types/node": "^20.2.5",
|
||||||
"@types/react": "18.2.7",
|
"@types/react": "18.2.7",
|
||||||
"@types/react-dom": "18.2.4",
|
"@types/react-dom": "18.2.4",
|
||||||
"eslint": "^8.41.0",
|
"eslint": "^8.41.0",
|
||||||
@ -41,17 +41,17 @@
|
|||||||
"rimraf": "^5.0.1",
|
"rimraf": "^5.0.1",
|
||||||
"ts-loader": "^9.4.3",
|
"ts-loader": "^9.4.3",
|
||||||
"typescript": "^5.0.4",
|
"typescript": "^5.0.4",
|
||||||
"webpack": "^5.84.1",
|
"webpack": "^5.85.0",
|
||||||
"webpack-cli": "^5.1.1",
|
"webpack-cli": "^5.1.1",
|
||||||
"webpack-dev-server": "^4.15.0"
|
"webpack-dev-server": "^4.15.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/readable-stream": "^2.3.15",
|
"@types/readable-stream": "^2.3.15",
|
||||||
"amazon-chime-sdk-js": "^3.14.0",
|
"amazon-chime-sdk-js": "^3.14.1",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"localforage": "^1.10.0",
|
"localforage": "^1.10.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"socket.io-client": "^4.6.1"
|
"socket.io-client": "^4.6.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,6 +118,7 @@ export const ServerSettingKey = {
|
|||||||
"clusterInferRatio": "clusterInferRatio",
|
"clusterInferRatio": "clusterInferRatio",
|
||||||
|
|
||||||
"indexRatio": "indexRatio",
|
"indexRatio": "indexRatio",
|
||||||
|
"protect": "protect",
|
||||||
"rvcQuality": "rvcQuality",
|
"rvcQuality": "rvcQuality",
|
||||||
"modelSamplingRate": "modelSamplingRate",
|
"modelSamplingRate": "modelSamplingRate",
|
||||||
"silenceFront": "silenceFront",
|
"silenceFront": "silenceFront",
|
||||||
@ -176,6 +177,7 @@ export type VoiceChangerServerSetting = {
|
|||||||
clusterInferRatio: number // so-vits-svc
|
clusterInferRatio: number // so-vits-svc
|
||||||
|
|
||||||
indexRatio: number // RVC
|
indexRatio: number // RVC
|
||||||
|
protect: number // RVC
|
||||||
rvcQuality: number // 0:low, 1:high
|
rvcQuality: number // 0:low, 1:high
|
||||||
silenceFront: number // 0:off, 1:on
|
silenceFront: number // 0:off, 1:on
|
||||||
modelSamplingRate: ModelSamplingRate // 32000,40000,48000
|
modelSamplingRate: ModelSamplingRate // 32000,40000,48000
|
||||||
@ -202,6 +204,7 @@ type ModelSlot = {
|
|||||||
|
|
||||||
defaultTune: number,
|
defaultTune: number,
|
||||||
defaultIndexRatio: number,
|
defaultIndexRatio: number,
|
||||||
|
defaultProtect: number,
|
||||||
|
|
||||||
modelType: ModelType,
|
modelType: ModelType,
|
||||||
embChannels: number,
|
embChannels: number,
|
||||||
@ -294,6 +297,7 @@ export const DefaultServerSetting: ServerInfo = {
|
|||||||
clusterInferRatio: 0,
|
clusterInferRatio: 0,
|
||||||
|
|
||||||
indexRatio: 0,
|
indexRatio: 0,
|
||||||
|
protect: 0.5,
|
||||||
rvcQuality: 0,
|
rvcQuality: 0,
|
||||||
modelSamplingRate: 48000,
|
modelSamplingRate: 48000,
|
||||||
silenceFront: 1,
|
silenceFront: 1,
|
||||||
@ -523,5 +527,6 @@ export type MergeModelRequest = {
|
|||||||
command: "mix",
|
command: "mix",
|
||||||
defaultTune: number,
|
defaultTune: number,
|
||||||
defaultIndexRatio: number,
|
defaultIndexRatio: number,
|
||||||
|
defaultProtect: number,
|
||||||
files: MergeElement[]
|
files: MergeElement[]
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ export type FileUploadSetting = {
|
|||||||
uploaded: boolean
|
uploaded: boolean
|
||||||
defaultTune: number
|
defaultTune: number
|
||||||
defaultIndexRatio: number
|
defaultIndexRatio: number
|
||||||
|
defaultProtect: number
|
||||||
framework: Framework
|
framework: Framework
|
||||||
params: string
|
params: string
|
||||||
|
|
||||||
@ -48,6 +49,7 @@ const InitialFileUploadSetting: FileUploadSetting = {
|
|||||||
uploaded: false,
|
uploaded: false,
|
||||||
defaultTune: 0,
|
defaultTune: 0,
|
||||||
defaultIndexRatio: 1,
|
defaultIndexRatio: 1,
|
||||||
|
defaultProtect: 0.5,
|
||||||
framework: Framework.PyTorch,
|
framework: Framework.PyTorch,
|
||||||
params: "{}",
|
params: "{}",
|
||||||
|
|
||||||
@ -372,6 +374,7 @@ export const useServerSetting = (props: UseServerSettingProps): ServerSettingSta
|
|||||||
const params = JSON.stringify({
|
const params = JSON.stringify({
|
||||||
defaultTune: fileUploadSetting.defaultTune || 0,
|
defaultTune: fileUploadSetting.defaultTune || 0,
|
||||||
defaultIndexRatio: fileUploadSetting.defaultIndexRatio || 1,
|
defaultIndexRatio: fileUploadSetting.defaultIndexRatio || 1,
|
||||||
|
defaultProtect: fileUploadSetting.defaultProtect || 0.5,
|
||||||
sampleId: fileUploadSetting.isSampleMode ? fileUploadSetting.sampleId || "" : "",
|
sampleId: fileUploadSetting.isSampleMode ? fileUploadSetting.sampleId || "" : "",
|
||||||
rvcIndexDownload: fileUploadSetting.rvcIndexDownload || false,
|
rvcIndexDownload: fileUploadSetting.rvcIndexDownload || false,
|
||||||
files: fileUploadSetting.isSampleMode ? {} : {
|
files: fileUploadSetting.isSampleMode ? {} : {
|
||||||
@ -432,6 +435,7 @@ export const useServerSetting = (props: UseServerSettingProps): ServerSettingSta
|
|||||||
uploaded: false, // キャッシュから読み込まれるときには、まだuploadされていないから。
|
uploaded: false, // キャッシュから読み込まれるときには、まだuploadされていないから。
|
||||||
defaultTune: fileUploadSetting.defaultTune,
|
defaultTune: fileUploadSetting.defaultTune,
|
||||||
defaultIndexRatio: fileUploadSetting.defaultIndexRatio,
|
defaultIndexRatio: fileUploadSetting.defaultIndexRatio,
|
||||||
|
defaultProtect: fileUploadSetting.defaultProtect,
|
||||||
framework: fileUploadSetting.framework,
|
framework: fileUploadSetting.framework,
|
||||||
params: fileUploadSetting.params,
|
params: fileUploadSetting.params,
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ class ModelSlot:
|
|||||||
indexFile: str = ""
|
indexFile: str = ""
|
||||||
defaultTune: int = 0
|
defaultTune: int = 0
|
||||||
defaultIndexRatio: int = 1
|
defaultIndexRatio: int = 1
|
||||||
|
defaultProtect: float = 0.5
|
||||||
isONNX: bool = False
|
isONNX: bool = False
|
||||||
modelType: str = EnumInferenceTypes.pyTorchRVC.value
|
modelType: str = EnumInferenceTypes.pyTorchRVC.value
|
||||||
samplingRate: int = -1
|
samplingRate: int = -1
|
||||||
|
@ -139,6 +139,7 @@ class RVC:
|
|||||||
|
|
||||||
slotInfo.defaultTune = params["defaultTune"]
|
slotInfo.defaultTune = params["defaultTune"]
|
||||||
slotInfo.defaultIndexRatio = params["defaultIndexRatio"]
|
slotInfo.defaultIndexRatio = params["defaultIndexRatio"]
|
||||||
|
slotInfo.defaultProtect = params["defaultProtect"]
|
||||||
slotInfo.isONNX = slotInfo.modelFile.endswith(".onnx")
|
slotInfo.isONNX = slotInfo.modelFile.endswith(".onnx")
|
||||||
|
|
||||||
if slotInfo.isONNX:
|
if slotInfo.isONNX:
|
||||||
@ -239,6 +240,7 @@ class RVC:
|
|||||||
# その他の設定
|
# その他の設定
|
||||||
self.next_trans = modelSlot.defaultTune
|
self.next_trans = modelSlot.defaultTune
|
||||||
self.next_index_ratio = modelSlot.defaultIndexRatio
|
self.next_index_ratio = modelSlot.defaultIndexRatio
|
||||||
|
self.next_protect = modelSlot.defaultProtect
|
||||||
self.next_samplingRate = modelSlot.samplingRate
|
self.next_samplingRate = modelSlot.samplingRate
|
||||||
self.next_framework = "ONNX" if modelSlot.isONNX else "PyTorch"
|
self.next_framework = "ONNX" if modelSlot.isONNX else "PyTorch"
|
||||||
# self.needSwitch = True
|
# self.needSwitch = True
|
||||||
@ -251,6 +253,7 @@ class RVC:
|
|||||||
self.pipeline = self.next_pipeline
|
self.pipeline = self.next_pipeline
|
||||||
self.settings.tran = self.next_trans
|
self.settings.tran = self.next_trans
|
||||||
self.settings.indexRatio = self.next_index_ratio
|
self.settings.indexRatio = self.next_index_ratio
|
||||||
|
self.settings.protect = self.next_protect
|
||||||
self.settings.modelSamplingRate = self.next_samplingRate
|
self.settings.modelSamplingRate = self.next_samplingRate
|
||||||
self.settings.framework = self.next_framework
|
self.settings.framework = self.next_framework
|
||||||
|
|
||||||
@ -346,6 +349,7 @@ class RVC:
|
|||||||
sid = 0
|
sid = 0
|
||||||
f0_up_key = self.settings.tran
|
f0_up_key = self.settings.tran
|
||||||
index_rate = self.settings.indexRatio
|
index_rate = self.settings.indexRatio
|
||||||
|
protect = self.settings.protect
|
||||||
if_f0 = 1 if self.settings.modelSlots[self.currentSlot].f0 else 0
|
if_f0 = 1 if self.settings.modelSlots[self.currentSlot].f0 else 0
|
||||||
embOutputLayer = self.settings.modelSlots[self.currentSlot].embOutputLayer
|
embOutputLayer = self.settings.modelSlots[self.currentSlot].embOutputLayer
|
||||||
useFinalProj = self.settings.modelSlots[self.currentSlot].useFinalProj
|
useFinalProj = self.settings.modelSlots[self.currentSlot].useFinalProj
|
||||||
@ -360,6 +364,7 @@ class RVC:
|
|||||||
embOutputLayer,
|
embOutputLayer,
|
||||||
useFinalProj,
|
useFinalProj,
|
||||||
repeat,
|
repeat,
|
||||||
|
protect,
|
||||||
)
|
)
|
||||||
|
|
||||||
result = audio_out.detach().cpu().numpy() * np.sqrt(vol)
|
result = audio_out.detach().cpu().numpy() * np.sqrt(vol)
|
||||||
@ -421,6 +426,7 @@ class RVC:
|
|||||||
params = {
|
params = {
|
||||||
"defaultTune": req.defaultTune,
|
"defaultTune": req.defaultTune,
|
||||||
"defaultIndexRatio": req.defaultIndexRatio,
|
"defaultIndexRatio": req.defaultIndexRatio,
|
||||||
|
"defaultProtect": req.defaultProtect,
|
||||||
"sampleId": "",
|
"sampleId": "",
|
||||||
"files": {"rvcModel": storeFile},
|
"files": {"rvcModel": storeFile},
|
||||||
}
|
}
|
||||||
@ -442,6 +448,7 @@ class RVC:
|
|||||||
)
|
)
|
||||||
params["defaultTune"] = self.settings.tran
|
params["defaultTune"] = self.settings.tran
|
||||||
params["defaultIndexRatio"] = self.settings.indexRatio
|
params["defaultIndexRatio"] = self.settings.indexRatio
|
||||||
|
params["defaultProtect"] = self.settings.protect
|
||||||
|
|
||||||
json.dump(params, open(os.path.join(slotDir, "params.json"), "w"))
|
json.dump(params, open(os.path.join(slotDir, "params.json"), "w"))
|
||||||
self.loadSlots()
|
self.loadSlots()
|
||||||
|
@ -24,6 +24,7 @@ class RVCSettings:
|
|||||||
sampleModels: list[RVCModelSample] = field(default_factory=lambda: [])
|
sampleModels: list[RVCModelSample] = field(default_factory=lambda: [])
|
||||||
|
|
||||||
indexRatio: float = 0
|
indexRatio: float = 0
|
||||||
|
protect: float = 0.5
|
||||||
rvcQuality: int = 0
|
rvcQuality: int = 0
|
||||||
silenceFront: int = 1 # 0:off, 1:on
|
silenceFront: int = 1 # 0:off, 1:on
|
||||||
modelSamplingRate: int = 48000
|
modelSamplingRate: int = 48000
|
||||||
@ -45,5 +46,5 @@ class RVCSettings:
|
|||||||
"isHalf",
|
"isHalf",
|
||||||
"enableDirectML",
|
"enableDirectML",
|
||||||
]
|
]
|
||||||
floatData = ["silentThreshold", "indexRatio"]
|
floatData = ["silentThreshold", "indexRatio", "protect"]
|
||||||
strData = ["framework", "f0Detector"]
|
strData = ["framework", "f0Detector"]
|
||||||
|
@ -82,9 +82,9 @@ def downloadInitialSampleModels(sampleJsons: list[str], model_dir: str):
|
|||||||
slotInfo.description = sample.description
|
slotInfo.description = sample.description
|
||||||
slotInfo.name = sample.name
|
slotInfo.name = sample.name
|
||||||
slotInfo.termsOfUseUrl = sample.termsOfUseUrl
|
slotInfo.termsOfUseUrl = sample.termsOfUseUrl
|
||||||
|
|
||||||
slotInfo.defaultTune = 0
|
slotInfo.defaultTune = 0
|
||||||
slotInfo.defaultIndexRatio = 1
|
slotInfo.defaultIndexRatio = 1
|
||||||
|
slotInfo.defaultProtect = 0.5
|
||||||
slotInfo.isONNX = slotInfo.modelFile.endswith(".onnx")
|
slotInfo.isONNX = slotInfo.modelFile.endswith(".onnx")
|
||||||
|
|
||||||
# この時点ではまだファイルはダウンロードされていない
|
# この時点ではまだファイルはダウンロードされていない
|
||||||
|
@ -17,4 +17,5 @@ class MergeModelRequest:
|
|||||||
slot: int = -1
|
slot: int = -1
|
||||||
defaultTune: int = 0
|
defaultTune: int = 0
|
||||||
defaultIndexRatio: int = 1
|
defaultIndexRatio: int = 1
|
||||||
|
defaultProtect: float = 0.5
|
||||||
files: List[MergeFile] = field(default_factory=lambda: [])
|
files: List[MergeFile] = field(default_factory=lambda: [])
|
||||||
|
@ -83,7 +83,9 @@ class Pipeline(object):
|
|||||||
embOutputLayer,
|
embOutputLayer,
|
||||||
useFinalProj,
|
useFinalProj,
|
||||||
repeat,
|
repeat,
|
||||||
|
protect=0.5,
|
||||||
):
|
):
|
||||||
|
search_index = self.index is not None and self.big_npy is not None and index_rate != 0
|
||||||
self.t_pad = self.sr * repeat
|
self.t_pad = self.sr * repeat
|
||||||
self.t_pad_tgt = self.targetSR * repeat
|
self.t_pad_tgt = self.targetSR * repeat
|
||||||
|
|
||||||
@ -136,10 +138,12 @@ class Pipeline(object):
|
|||||||
raise DeviceChangingException()
|
raise DeviceChangingException()
|
||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
|
if protect < 0.5 and search_index:
|
||||||
|
feats0 = feats.clone()
|
||||||
|
|
||||||
# Index - feature抽出
|
# Index - feature抽出
|
||||||
# if self.index is not None and self.feature is not None and index_rate != 0:
|
# if self.index is not None and self.feature is not None and index_rate != 0:
|
||||||
if self.index is not None and self.big_npy is not None and index_rate != 0:
|
if search_index:
|
||||||
npy = feats[0].cpu().numpy()
|
npy = feats[0].cpu().numpy()
|
||||||
if self.isHalf is True:
|
if self.isHalf is True:
|
||||||
npy = npy.astype("float32")
|
npy = npy.astype("float32")
|
||||||
@ -165,7 +169,10 @@ class Pipeline(object):
|
|||||||
+ (1 - index_rate) * feats
|
+ (1 - index_rate) * feats
|
||||||
)
|
)
|
||||||
feats = F.interpolate(feats.permute(0, 2, 1), scale_factor=2).permute(0, 2, 1)
|
feats = F.interpolate(feats.permute(0, 2, 1), scale_factor=2).permute(0, 2, 1)
|
||||||
|
if protect < 0.5 and search_index:
|
||||||
|
feats0 = F.interpolate(feats0.permute(0, 2, 1), scale_factor=2).permute(
|
||||||
|
0, 2, 1
|
||||||
|
)
|
||||||
# ピッチサイズ調整
|
# ピッチサイズ調整
|
||||||
p_len = audio_pad.shape[0] // self.window
|
p_len = audio_pad.shape[0] // self.window
|
||||||
if feats.shape[1] < p_len:
|
if feats.shape[1] < p_len:
|
||||||
@ -173,6 +180,15 @@ class Pipeline(object):
|
|||||||
if pitch is not None and pitchf is not None:
|
if pitch is not None and pitchf is not None:
|
||||||
pitch = pitch[:, :p_len]
|
pitch = pitch[:, :p_len]
|
||||||
pitchf = pitchf[:, :p_len]
|
pitchf = pitchf[:, :p_len]
|
||||||
|
|
||||||
|
# pitchの推定が上手くいかない(pitchf=0)場合、検索前の特徴を混ぜる
|
||||||
|
if protect < 0.5 and search_index:
|
||||||
|
pitchff = pitchf.clone()
|
||||||
|
pitchff[pitchf > 0] = 1
|
||||||
|
pitchff[pitchf < 1] = protect
|
||||||
|
pitchff = pitchff.unsqueeze(-1)
|
||||||
|
feats = feats * pitchff + feats0 * (1 - pitchff)
|
||||||
|
feats = feats.to(feats0.dtype)
|
||||||
p_len = torch.tensor([p_len], device=self.device).long()
|
p_len = torch.tensor([p_len], device=self.device).long()
|
||||||
|
|
||||||
# 推論実行
|
# 推論実行
|
||||||
|
@ -29,7 +29,7 @@ class CrepePitchExtractor(PitchExtractor):
|
|||||||
f0_mel_min = 1127 * np.log(1 + f0_min / 700)
|
f0_mel_min = 1127 * np.log(1 + f0_min / 700)
|
||||||
f0_mel_max = 1127 * np.log(1 + f0_max / 700)
|
f0_mel_max = 1127 * np.log(1 + f0_max / 700)
|
||||||
|
|
||||||
f0 = torchcrepe.predict(
|
f0, pd = torchcrepe.predict(
|
||||||
audio.unsqueeze(0),
|
audio.unsqueeze(0),
|
||||||
sr,
|
sr,
|
||||||
hop_length=window,
|
hop_length=window,
|
||||||
@ -40,8 +40,11 @@ class CrepePitchExtractor(PitchExtractor):
|
|||||||
batch_size=256,
|
batch_size=256,
|
||||||
decoder=torchcrepe.decode.weighted_argmax,
|
decoder=torchcrepe.decode.weighted_argmax,
|
||||||
device=self.device,
|
device=self.device,
|
||||||
|
return_periodicity=True,
|
||||||
)
|
)
|
||||||
f0 = torchcrepe.filter.median(f0, 3)
|
f0 = torchcrepe.filter.median(f0, 3) # 本家だとmeanですが、harvestに合わせmedianフィルタ
|
||||||
|
pd = torchcrepe.filter.median(pd, 3)
|
||||||
|
f0[pd < 0.1] = 0
|
||||||
f0 = f0.squeeze()
|
f0 = f0.squeeze()
|
||||||
|
|
||||||
f0 = torch.nn.functional.pad(
|
f0 = torch.nn.functional.pad(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user