This commit is contained in:
w-okada 2023-11-04 04:34:43 +09:00
parent 6272936e14
commit 4f7969176f
14 changed files with 263 additions and 230 deletions

2
.gitignore vendored
View File

@ -68,3 +68,5 @@ venv/
beatrice_internal_api.cp310-win_amd64.pyd beatrice_internal_api.cp310-win_amd64.pyd
108_average_110b_10.bin 108_average_110b_10.bin
server/model_dir_static/Beatrice-JVS

View File

@ -1,4 +1,11 @@
cd ~/git-work/voice-changer-js/lib/ ; npm run build:dev; cd - # cd ~/git-work/voice-changer-js/lib/ ; npm run build:dev; cd -
# rm -rf node_modules/@dannadori/voice-changer-js
# mkdir -p node_modules/@dannadori/voice-changer-js/dist
# cp -r ~/git-work/voice-changer-js/lib/package.json node_modules/@dannadori/voice-changer-js/
# cp -r ~/git-work/voice-changer-js/lib/dist node_modules/@dannadori/voice-changer-js/
cd ~/git-work/voice-changer-js/lib/ ; npm run build:prod; cd -
rm -rf node_modules/@dannadori/voice-changer-js rm -rf node_modules/@dannadori/voice-changer-js
mkdir -p node_modules/@dannadori/voice-changer-js/dist mkdir -p node_modules/@dannadori/voice-changer-js/dist
cp -r ~/git-work/voice-changer-js/lib/package.json node_modules/@dannadori/voice-changer-js/ cp -r ~/git-work/voice-changer-js/lib/package.json node_modules/@dannadori/voice-changer-js/

View File

@ -55,6 +55,7 @@ export const ModelSlotArea = (_props: ModelSlotAreaProps) => {
); );
const clickAction = async () => { const clickAction = async () => {
// @ts-ignore
const dummyModelSlotIndex = Math.floor(Date.now() / 1000) * 1000 + x.slotIndex; const dummyModelSlotIndex = Math.floor(Date.now() / 1000) * 1000 + x.slotIndex;
await serverSetting.updateServerSettings({ ...serverSetting.serverSetting, modelSlotIndex: dummyModelSlotIndex }); await serverSetting.updateServerSettings({ ...serverSetting.serverSetting, modelSlotIndex: dummyModelSlotIndex });
setTimeout(() => { setTimeout(() => {

View File

@ -1,55 +1,59 @@
import React, { useMemo } from "react" import React, { useMemo } from "react";
import { useAppState } from "../../../001_provider/001_AppStateProvider" import { useAppState } from "../../../001_provider/001_AppStateProvider";
export type TuningAreaProps = {
}
export type TuningAreaProps = {};
export const TuningArea = (_props: TuningAreaProps) => { export const TuningArea = (_props: TuningAreaProps) => {
const { serverSetting } = useAppState() const { serverSetting } = useAppState();
const selected = useMemo(() => { const selected = useMemo(() => {
if (serverSetting.serverSetting.modelSlotIndex == undefined) { if (serverSetting.serverSetting.modelSlotIndex == undefined) {
return return;
} else if (serverSetting.serverSetting.modelSlotIndex == "Beatrice-JVS") {
const beatriceJVS = serverSetting.serverSetting.modelSlots.find((v) => v.slotIndex == "Beatrice-JVS");
return beatriceJVS;
} else {
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex];
} }
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex] }, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots]);
}, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots])
const tuningArea = useMemo(() => { const tuningArea = useMemo(() => {
if (!selected) { if (!selected) {
return <></> return <></>;
} }
if (selected.voiceChangerType == "MMVCv13" || selected.voiceChangerType == "MMVCv15") { if (selected.voiceChangerType == "MMVCv13" || selected.voiceChangerType == "MMVCv15") {
return <></> return <></>;
} }
const currentTuning = serverSetting.serverSetting.tran const currentTuning = serverSetting.serverSetting.tran;
const tranValueUpdatedAction = async (val: number) => { const tranValueUpdatedAction = async (val: number) => {
await serverSetting.updateServerSettings({ ...serverSetting.serverSetting, tran: val }) await serverSetting.updateServerSettings({ ...serverSetting.serverSetting, tran: val });
} };
return ( return (
<div className="character-area-control"> <div className="character-area-control">
<div className="character-area-control-title"> <div className="character-area-control-title">TUNE:</div>
TUNE:
</div>
<div className="character-area-control-field"> <div className="character-area-control-field">
<div className="character-area-slider-control"> <div className="character-area-slider-control">
<span className="character-area-slider-control-kind"></span> <span className="character-area-slider-control-kind"></span>
<span className="character-area-slider-control-slider"> <span className="character-area-slider-control-slider">
<input type="range" min="-50" max="50" step="1" value={currentTuning} onChange={(e) => { <input
tranValueUpdatedAction(Number(e.target.value)) type="range"
}}></input> min="-50"
max="50"
step="1"
value={currentTuning}
onChange={(e) => {
tranValueUpdatedAction(Number(e.target.value));
}}
></input>
</span> </span>
<span className="character-area-slider-control-val">{currentTuning}</span> <span className="character-area-slider-control-val">{currentTuning}</span>
</div> </div>
</div> </div>
</div> </div>
) );
}, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]) }, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]);
return tuningArea;
return tuningArea };
}

View File

@ -1,56 +1,59 @@
import React, { useMemo } from "react" import React, { useMemo } from "react";
import { useAppState } from "../../../001_provider/001_AppStateProvider" import { useAppState } from "../../../001_provider/001_AppStateProvider";
export type IndexAreaProps = {
}
export type IndexAreaProps = {};
export const IndexArea = (_props: IndexAreaProps) => { export const IndexArea = (_props: IndexAreaProps) => {
const { serverSetting } = useAppState() const { serverSetting } = useAppState();
const selected = useMemo(() => { const selected = useMemo(() => {
if (serverSetting.serverSetting.modelSlotIndex == undefined) { if (serverSetting.serverSetting.modelSlotIndex == undefined) {
return return;
} else if (serverSetting.serverSetting.modelSlotIndex == "Beatrice-JVS") {
const beatriceJVS = serverSetting.serverSetting.modelSlots.find((v) => v.slotIndex == "Beatrice-JVS");
return beatriceJVS;
} else {
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex];
} }
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex] }, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots]);
}, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots])
const indexArea = useMemo(() => { const indexArea = useMemo(() => {
if (!selected) { if (!selected) {
return <></> return <></>;
} }
if (selected.voiceChangerType != "RVC") { if (selected.voiceChangerType != "RVC") {
return <></> return <></>;
} }
const currentIndexRatio = serverSetting.serverSetting.indexRatio const currentIndexRatio = serverSetting.serverSetting.indexRatio;
const indexRatioValueUpdatedAction = async (val: number) => { const indexRatioValueUpdatedAction = async (val: number) => {
await serverSetting.updateServerSettings({ ...serverSetting.serverSetting, indexRatio: val }) await serverSetting.updateServerSettings({ ...serverSetting.serverSetting, indexRatio: val });
} };
return ( return (
<div className="character-area-control"> <div className="character-area-control">
<div className="character-area-control-title"> <div className="character-area-control-title">INDEX:</div>
INDEX:
</div>
<div className="character-area-control-field"> <div className="character-area-control-field">
<div className="character-area-slider-control"> <div className="character-area-slider-control">
<span className="character-area-slider-control-kind"></span> <span className="character-area-slider-control-kind"></span>
<span className="character-area-slider-control-slider"> <span className="character-area-slider-control-slider">
<input type="range" min="0" max="1" step="0.1" value={currentIndexRatio} onChange={(e) => { <input
indexRatioValueUpdatedAction(Number(e.target.value)) type="range"
}}></input> min="0"
max="1"
step="0.1"
value={currentIndexRatio}
onChange={(e) => {
indexRatioValueUpdatedAction(Number(e.target.value));
}}
></input>
</span> </span>
<span className="character-area-slider-control-val">{currentIndexRatio}</span> <span className="character-area-slider-control-val">{currentIndexRatio}</span>
</div> </div>
</div> </div>
</div> </div>
) );
}, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]) }, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]);
return indexArea;
};
return indexArea
}

View File

@ -1,113 +1,109 @@
import React, { useMemo } from "react" import React, { useMemo } from "react";
import { useAppState } from "../../../001_provider/001_AppStateProvider" import { useAppState } from "../../../001_provider/001_AppStateProvider";
export type SpeakerAreaProps = {
}
export type SpeakerAreaProps = {};
export const SpeakerArea = (_props: SpeakerAreaProps) => { export const SpeakerArea = (_props: SpeakerAreaProps) => {
const { serverSetting } = useAppState() const { serverSetting } = useAppState();
const selected = useMemo(() => { const selected = useMemo(() => {
if (serverSetting.serverSetting.modelSlotIndex == undefined) { if (serverSetting.serverSetting.modelSlotIndex == undefined) {
return return;
} else if (serverSetting.serverSetting.modelSlotIndex == "Beatrice-JVS") {
const beatriceJVS = serverSetting.serverSetting.modelSlots.find((v) => v.slotIndex == "Beatrice-JVS");
return beatriceJVS;
} else {
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex];
} }
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex] }, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots]);
}, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots])
const srcArea = useMemo(() => { const srcArea = useMemo(() => {
if (!selected) { if (!selected) {
return <></> return <></>;
} }
if (selected.voiceChangerType != "MMVCv13" && selected.voiceChangerType != "MMVCv15") { if (selected.voiceChangerType != "MMVCv13" && selected.voiceChangerType != "MMVCv15") {
return <></> return <></>;
} }
const options = Object.keys(selected.speakers).map(key => { const options = Object.keys(selected.speakers).map((key) => {
const val = selected.speakers[Number(key)] const val = selected.speakers[Number(key)];
return ( return (
<option key={key} value={key}>{val}[{key}]</option> <option key={key} value={key}>
) {val}[{key}]
}) </option>
);
});
const srcSpeakerValueUpdatedAction = async (val: number) => { const srcSpeakerValueUpdatedAction = async (val: number) => {
await serverSetting.updateServerSettings({ ...serverSetting.serverSetting, srcId: val }) await serverSetting.updateServerSettings({ ...serverSetting.serverSetting, srcId: val });
} };
return ( return (
<div className="character-area-control"> <div className="character-area-control">
<div className="character-area-control-title"> <div className="character-area-control-title">Voice:</div>
Voice:
</div>
<div className="character-area-control-field"> <div className="character-area-control-field">
<div className="character-area-slider-control"> <div className="character-area-slider-control">
<span className="character-area-slider-control-kind">src</span> <span className="character-area-slider-control-kind">src</span>
<span className="character-area-slider-control-slider"> <span className="character-area-slider-control-slider">
<select value={serverSetting.serverSetting.srcId} onChange={(e) => { srcSpeakerValueUpdatedAction(Number(e.target.value)) }}> <select
value={serverSetting.serverSetting.srcId}
onChange={(e) => {
srcSpeakerValueUpdatedAction(Number(e.target.value));
}}
>
{options} {options}
</select> </select>
</span> </span>
</div> </div>
</div> </div>
</div> </div>
) );
}, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]) }, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]);
const dstArea = useMemo(() => { const dstArea = useMemo(() => {
if (!selected) { if (!selected) {
return <></> return <></>;
} }
const options = Object.keys(selected.speakers).map(key => { const options = Object.keys(selected.speakers).map((key) => {
const val = selected.speakers[Number(key)] const val = selected.speakers[Number(key)];
return ( return (
<option key={key} value={key}>{val}[{key}]</option> <option key={key} value={key}>
) {val}[{key}]
}) </option>
);
});
const srcSpeakerValueUpdatedAction = async (val: number) => { const srcSpeakerValueUpdatedAction = async (val: number) => {
await serverSetting.updateServerSettings({ ...serverSetting.serverSetting, dstId: val }) await serverSetting.updateServerSettings({ ...serverSetting.serverSetting, dstId: val });
} };
return ( return (
<div className="character-area-control"> <div className="character-area-control">
<div className="character-area-control-title"> <div className="character-area-control-title">{selected.voiceChangerType == "DDSP-SVC" || selected.voiceChangerType == "so-vits-svc-40" || selected.voiceChangerType == "RVC" || selected.voiceChangerType == "Beatrice" ? "Voice:" : ""}</div>
{
selected.voiceChangerType == "DDSP-SVC" ||
selected.voiceChangerType == "so-vits-svc-40" ||
selected.voiceChangerType == "RVC" ? "Voice:" : ""
}
</div>
<div className="character-area-control-field"> <div className="character-area-control-field">
<div className="character-area-slider-control"> <div className="character-area-slider-control">
<span className="character-area-slider-control-kind"> <span className="character-area-slider-control-kind">{selected.voiceChangerType == "MMVCv13" || selected.voiceChangerType == "MMVCv15" ? "dst" : ""}</span>
{
selected.voiceChangerType == "MMVCv13" ||
selected.voiceChangerType == "MMVCv15" ? "dst" : ""
}
</span>
<span className="character-area-slider-control-slider"> <span className="character-area-slider-control-slider">
<select value={serverSetting.serverSetting.dstId} onChange={(e) => { srcSpeakerValueUpdatedAction(Number(e.target.value)) }}> <select
value={serverSetting.serverSetting.dstId}
onChange={(e) => {
srcSpeakerValueUpdatedAction(Number(e.target.value));
}}
>
{options} {options}
</select> </select>
</span> </span>
</div> </div>
</div> </div>
</div> </div>
) );
}, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]) }, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]);
return ( return (
<> <>
{srcArea} {srcArea}
{dstArea} {dstArea}
</> </>
) );
} };

View File

@ -1,72 +1,70 @@
import React, { useMemo } from "react" import React, { useMemo } from "react";
import { useAppState } from "../../../001_provider/001_AppStateProvider" import { useAppState } from "../../../001_provider/001_AppStateProvider";
import { MMVCv15ModelSlot } from "@dannadori/voice-changer-client-js" import { MMVCv15ModelSlot } from "@dannadori/voice-changer-client-js";
export type SpeakerAreaProps = {
}
export type SpeakerAreaProps = {};
export const F0FactorArea = (_props: SpeakerAreaProps) => { export const F0FactorArea = (_props: SpeakerAreaProps) => {
const { serverSetting } = useAppState() const { serverSetting } = useAppState();
const selected = useMemo(() => { const selected = useMemo(() => {
if (serverSetting.serverSetting.modelSlotIndex == undefined) { if (serverSetting.serverSetting.modelSlotIndex == undefined) {
return return;
} else if (serverSetting.serverSetting.modelSlotIndex == "Beatrice-JVS") {
const beatriceJVS = serverSetting.serverSetting.modelSlots.find((v) => v.slotIndex == "Beatrice-JVS");
return beatriceJVS;
} else {
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex];
} }
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex] }, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots]);
}, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots])
const f0FactorArea = useMemo(() => { const f0FactorArea = useMemo(() => {
if (!selected) { if (!selected) {
return <></> return <></>;
} }
if (selected.voiceChangerType != "MMVCv15") { if (selected.voiceChangerType != "MMVCv15") {
return <></> return <></>;
} }
const selectedMMVCv15 = selected as MMVCv15ModelSlot const selectedMMVCv15 = selected as MMVCv15ModelSlot;
const recommendF0 = (selectedMMVCv15.f0[serverSetting.serverSetting.dstId] / selectedMMVCv15.f0[serverSetting.serverSetting.srcId]).toFixed(2) const recommendF0 = (selectedMMVCv15.f0[serverSetting.serverSetting.dstId] / selectedMMVCv15.f0[serverSetting.serverSetting.srcId]).toFixed(2);
return ( return (
<> <>
<div className="character-area-control"> <div className="character-area-control">
<div className="character-area-control-title"> <div className="character-area-control-title">F0Factor:</div>
F0Factor:
</div>
<div className="character-area-control-field"> <div className="character-area-control-field">
<div className="character-area-slider-control"> <div className="character-area-slider-control">
<span className="character-area-slider-control-kind"></span> <span className="character-area-slider-control-kind"></span>
<span className="character-area-slider-control-slider"> <span className="character-area-slider-control-slider">
<input type="range" min="0.01" max="5.00" step="0.01" value={serverSetting.serverSetting.f0Factor} onChange={(e) => { <input
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, f0Factor: Number(e.target.value) }) type="range"
}}></input> min="0.01"
max="5.00"
step="0.01"
value={serverSetting.serverSetting.f0Factor}
onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, f0Factor: Number(e.target.value) });
}}
></input>
</span> </span>
<span className="character-area-slider-control-val">{serverSetting.serverSetting.f0Factor}</span> <span className="character-area-slider-control-val">{serverSetting.serverSetting.f0Factor}</span>
</div> </div>
</div> </div>
</div> </div>
<div className="character-area-control"> <div className="character-area-control">
<div className="character-area-control-title"> <div className="character-area-control-title"></div>
</div>
<div className="character-area-control-field"> <div className="character-area-control-field">
<div className="character-area-slider-control"> <div className="character-area-slider-control">
<span className="character-area-slider-control-text">recommend:</span> <span className="character-area-slider-control-text">recommend:</span>
<span className="character-area-slider-control-text"> <span className="character-area-slider-control-text">{recommendF0}</span>
{recommendF0}
</span>
</div> </div>
</div> </div>
</div> </div>
</> </>
) );
}, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]) }, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]);
return f0FactorArea;
return f0FactorArea };
}

View File

@ -1,81 +1,86 @@
import React, { useMemo } from "react" import React, { useMemo } from "react";
import { useAppState } from "../../../001_provider/001_AppStateProvider" import { useAppState } from "../../../001_provider/001_AppStateProvider";
export type SoVitsSVC40SettingAreaProps = {
}
export type SoVitsSVC40SettingAreaProps = {};
export const SoVitsSVC40SettingArea = (_props: SoVitsSVC40SettingAreaProps) => { export const SoVitsSVC40SettingArea = (_props: SoVitsSVC40SettingAreaProps) => {
const { serverSetting } = useAppState() const { serverSetting } = useAppState();
const selected = useMemo(() => { const selected = useMemo(() => {
if (serverSetting.serverSetting.modelSlotIndex == undefined) { if (serverSetting.serverSetting.modelSlotIndex == undefined) {
return return;
} else if (serverSetting.serverSetting.modelSlotIndex == "Beatrice-JVS") {
const beatriceJVS = serverSetting.serverSetting.modelSlots.find((v) => v.slotIndex == "Beatrice-JVS");
return beatriceJVS;
} else {
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex];
} }
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex] }, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots]);
}, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots])
const settingArea = useMemo(() => { const settingArea = useMemo(() => {
if (!selected) { if (!selected) {
return <></> return <></>;
} }
if (selected.voiceChangerType != "so-vits-svc-40") { if (selected.voiceChangerType != "so-vits-svc-40") {
return <></> return <></>;
} }
const cluster = ( const cluster = (
<div className="character-area-control"> <div className="character-area-control">
<div className="character-area-control-title"> <div className="character-area-control-title">Cluster:</div>
Cluster:
</div>
<div className="character-area-control-field"> <div className="character-area-control-field">
<div className="character-area-slider-control"> <div className="character-area-slider-control">
<span className="character-area-slider-control-kind"></span> <span className="character-area-slider-control-kind"></span>
<span className="character-area-slider-control-slider"> <span className="character-area-slider-control-slider">
<input type="range" min="0" max="1.0" step="0.1" value={serverSetting.serverSetting.clusterInferRatio} onChange={(e) => { <input
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, clusterInferRatio: Number(e.target.value) }) type="range"
}}></input> min="0"
max="1.0"
step="0.1"
value={serverSetting.serverSetting.clusterInferRatio}
onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, clusterInferRatio: Number(e.target.value) });
}}
></input>
</span> </span>
<span className="character-area-slider-control-val">{serverSetting.serverSetting.clusterInferRatio}</span> <span className="character-area-slider-control-val">{serverSetting.serverSetting.clusterInferRatio}</span>
</div> </div>
</div> </div>
</div> </div>
) );
const noise = ( const noise = (
<div className="character-area-control"> <div className="character-area-control">
<div className="character-area-control-title"> <div className="character-area-control-title">Noise:</div>
Noise:
</div>
<div className="character-area-control-field"> <div className="character-area-control-field">
<div className="character-area-slider-control"> <div className="character-area-slider-control">
<span className="character-area-slider-control-kind"></span> <span className="character-area-slider-control-kind"></span>
<span className="character-area-slider-control-slider"> <span className="character-area-slider-control-slider">
<input type="range" min="0" max="1.0" step="0.1" value={serverSetting.serverSetting.noiseScale} onChange={(e) => { <input
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, noiseScale: Number(e.target.value) }) type="range"
}}></input> min="0"
max="1.0"
step="0.1"
value={serverSetting.serverSetting.noiseScale}
onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, noiseScale: Number(e.target.value) });
}}
></input>
</span> </span>
<span className="character-area-slider-control-val">{serverSetting.serverSetting.noiseScale}</span> <span className="character-area-slider-control-val">{serverSetting.serverSetting.noiseScale}</span>
</div> </div>
</div> </div>
</div> </div>
) );
return ( return (
<> <>
{cluster} {cluster}
{noise} {noise}
</> </>
) );
}, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]) }, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]);
return settingArea;
return settingArea };
}

View File

@ -1,81 +1,86 @@
import React, { useMemo } from "react" import React, { useMemo } from "react";
import { useAppState } from "../../../001_provider/001_AppStateProvider" import { useAppState } from "../../../001_provider/001_AppStateProvider";
export type DDSPSVC30SettingAreaProps = {
}
export type DDSPSVC30SettingAreaProps = {};
export const DDSPSVC30SettingArea = (_props: DDSPSVC30SettingAreaProps) => { export const DDSPSVC30SettingArea = (_props: DDSPSVC30SettingAreaProps) => {
const { serverSetting } = useAppState() const { serverSetting } = useAppState();
const selected = useMemo(() => { const selected = useMemo(() => {
if (serverSetting.serverSetting.modelSlotIndex == undefined) { if (serverSetting.serverSetting.modelSlotIndex == undefined) {
return return;
} else if (serverSetting.serverSetting.modelSlotIndex == "Beatrice-JVS") {
const beatriceJVS = serverSetting.serverSetting.modelSlots.find((v) => v.slotIndex == "Beatrice-JVS");
return beatriceJVS;
} else {
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex];
} }
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex] }, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots]);
}, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots])
const settingArea = useMemo(() => { const settingArea = useMemo(() => {
if (!selected) { if (!selected) {
return <></> return <></>;
} }
if (selected.voiceChangerType != "DDSP-SVC") { if (selected.voiceChangerType != "DDSP-SVC") {
return <></> return <></>;
} }
const acc = ( const acc = (
<div className="character-area-control"> <div className="character-area-control">
<div className="character-area-control-title"> <div className="character-area-control-title">ACC:</div>
ACC:
</div>
<div className="character-area-control-field"> <div className="character-area-control-field">
<div className="character-area-slider-control"> <div className="character-area-slider-control">
<span className="character-area-slider-control-kind"></span> <span className="character-area-slider-control-kind"></span>
<span className="character-area-slider-control-slider"> <span className="character-area-slider-control-slider">
<input type="range" min="1" max="20" step="1" value={serverSetting.serverSetting.diffAcc} onChange={(e) => { <input
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, diffAcc: Number(e.target.value) }) type="range"
}}></input> min="1"
max="20"
step="1"
value={serverSetting.serverSetting.diffAcc}
onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, diffAcc: Number(e.target.value) });
}}
></input>
</span> </span>
<span className="character-area-slider-control-val">{serverSetting.serverSetting.diffAcc}</span> <span className="character-area-slider-control-val">{serverSetting.serverSetting.diffAcc}</span>
</div> </div>
</div> </div>
</div> </div>
) );
const kstep = ( const kstep = (
<div className="character-area-control"> <div className="character-area-control">
<div className="character-area-control-title"> <div className="character-area-control-title">Kstep:</div>
Kstep:
</div>
<div className="character-area-control-field"> <div className="character-area-control-field">
<div className="character-area-slider-control"> <div className="character-area-slider-control">
<span className="character-area-slider-control-kind"></span> <span className="character-area-slider-control-kind"></span>
<span className="character-area-slider-control-slider"> <span className="character-area-slider-control-slider">
<input type="range" min="21" max="300" step="1" value={serverSetting.serverSetting.kStep} onChange={(e) => { <input
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, kStep: Number(e.target.value) }) type="range"
}}></input> min="21"
max="300"
step="1"
value={serverSetting.serverSetting.kStep}
onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, kStep: Number(e.target.value) });
}}
></input>
</span> </span>
<span className="character-area-slider-control-val">{serverSetting.serverSetting.kStep}</span> <span className="character-area-slider-control-val">{serverSetting.serverSetting.kStep}</span>
</div> </div>
</div> </div>
</div> </div>
) );
return ( return (
<> <>
{acc} {acc}
{kstep} {kstep}
</> </>
) );
}, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]) }, [serverSetting.serverSetting, serverSetting.updateServerSettings, selected]);
return settingArea;
return settingArea };
}

View File

@ -10,8 +10,12 @@ export const DiffusionSVCSettingArea = (_props: DiffusionSVCSettingAreaProps) =>
const selected = useMemo(() => { const selected = useMemo(() => {
if (serverSetting.serverSetting.modelSlotIndex == undefined) { if (serverSetting.serverSetting.modelSlotIndex == undefined) {
return; return;
} } else if (serverSetting.serverSetting.modelSlotIndex == "Beatrice-JVS") {
const beatriceJVS = serverSetting.serverSetting.modelSlots.find((v) => v.slotIndex == "Beatrice-JVS");
return beatriceJVS;
} else {
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex]; return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex];
}
}, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots]); }, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots]);
const settingArea = useMemo(() => { const settingArea = useMemo(() => {

View File

@ -28,8 +28,12 @@ export const CharacterArea = (_props: CharacterAreaProps) => {
const selected = useMemo(() => { const selected = useMemo(() => {
if (serverSetting.serverSetting.modelSlotIndex == undefined) { if (serverSetting.serverSetting.modelSlotIndex == undefined) {
return; return;
} } else if (serverSetting.serverSetting.modelSlotIndex == "Beatrice-JVS") {
const beatriceJVS = serverSetting.serverSetting.modelSlots.find((v) => v.slotIndex == "Beatrice-JVS");
return beatriceJVS;
} else {
return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex]; return serverSetting.serverSetting.modelSlots[serverSetting.serverSetting.modelSlotIndex];
}
}, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots]); }, [serverSetting.serverSetting.modelSlotIndex, serverSetting.serverSetting.modelSlots]);
useEffect(() => { useEffect(() => {
@ -49,7 +53,8 @@ export const CharacterArea = (_props: CharacterAreaProps) => {
return <></>; return <></>;
} }
const icon = selected.iconFile.length > 0 ? serverSetting.serverSetting.voiceChangerParams.model_dir + "/" + selected.slotIndex + "/" + selected.iconFile.split(/[\/\\]/).pop() : "./assets/icons/human.png"; const modelDir = serverSetting.serverSetting.modelSlotIndex == "Beatrice-JVS" ? "model_dir_static" : serverSetting.serverSetting.voiceChangerParams.model_dir;
const icon = selected.iconFile.length > 0 ? modelDir + "/" + selected.slotIndex + "/" + selected.iconFile.split(/[\/\\]/).pop() : "./assets/icons/human.png";
const selectedTermOfUseUrlLink = selected.termsOfUseUrl ? ( const selectedTermOfUseUrlLink = selected.termsOfUseUrl ? (
<a href={selected.termsOfUseUrl} target="_blank" rel="noopener noreferrer" className="portrait-area-terms-of-use-link"> <a href={selected.termsOfUseUrl} target="_blank" rel="noopener noreferrer" className="portrait-area-terms-of-use-link">
[{messageBuilderState.getMessage(__filename, "terms_of_use")}] [{messageBuilderState.getMessage(__filename, "terms_of_use")}]

View File

@ -14,6 +14,11 @@ export const VoiceChangerType = {
} as const; } as const;
export type VoiceChangerType = (typeof VoiceChangerType)[keyof typeof VoiceChangerType]; export type VoiceChangerType = (typeof VoiceChangerType)[keyof typeof VoiceChangerType];
export const StaticModel = {
BeatriceJVS: "Beatrice-JVS",
} as const;
export type StaticModel = (typeof StaticModel)[keyof typeof StaticModel];
/////////////////////// ///////////////////////
// サーバセッティング // サーバセッティング
/////////////////////// ///////////////////////
@ -174,7 +179,7 @@ export type VoiceChangerServerSetting = {
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
modelSlotIndex: number; modelSlotIndex: number | StaticModel;
useEnhancer: number; // DDSP-SVC useEnhancer: number; // DDSP-SVC
useDiff: number; // DDSP-SVC useDiff: number; // DDSP-SVC
@ -194,7 +199,7 @@ export type VoiceChangerServerSetting = {
}; };
type ModelSlot = { type ModelSlot = {
slotIndex: number; slotIndex: number | StaticModel;
voiceChangerType: VoiceChangerType; voiceChangerType: VoiceChangerType;
name: string; name: string;
description: string; description: string;

View File

@ -107,8 +107,6 @@ def getSampleJsonAndModelIds(mode: RVCSampleMode):
("Amitaro_o", {"useIndex": False}), ("Amitaro_o", {"useIndex": False}),
("KikotoMahiro_o", {"useIndex": False}), ("KikotoMahiro_o", {"useIndex": False}),
("TokinaShigure_o", {"useIndex": False}), ("TokinaShigure_o", {"useIndex": False}),
("Amitaro_16k_o", {"useIndex": False}),
("Amitaro_16k_nof0_o", {"useIndex": False}),
] ]
elif mode == "testAll": elif mode == "testAll":
return [ return [

View File

@ -142,7 +142,7 @@ def loadSlotInfo(model_dir: str, slotIndex: int | StaticSlot) -> ModelSlots:
jsonFile = os.path.join(slotDir, "params.json") jsonFile = os.path.join(slotDir, "params.json")
if not os.path.exists(jsonFile): if not os.path.exists(jsonFile):
return ModelSlot() return ModelSlot()
jsonDict = json.load(open(os.path.join(slotDir, "params.json"))) jsonDict = json.load(open(jsonFile, encoding="utf-8"))
slotInfoKey = list(ModelSlot.__annotations__.keys()) slotInfoKey = list(ModelSlot.__annotations__.keys())
slotInfo = ModelSlot(**{k: v for k, v in jsonDict.items() if k in slotInfoKey}) slotInfo = ModelSlot(**{k: v for k, v in jsonDict.items() if k in slotInfoKey})
if slotInfo.voiceChangerType == "RVC": if slotInfo.voiceChangerType == "RVC":