mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-01-23 13:35:12 +03:00
automatic f0 setting
This commit is contained in:
parent
f73178b9b0
commit
25a673b66f
2
client/demo/dist/index.js
vendored
2
client/demo/dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
import React, { useMemo, useState } from "react"
|
||||
import React, { useEffect, useMemo, useState } from "react"
|
||||
import { ClientState } from "@dannadori/voice-changer-client-js";
|
||||
|
||||
export type UseSpeakerSettingProps = {
|
||||
@ -9,6 +9,18 @@ export const useSpeakerSetting = (props: UseSpeakerSettingProps) => {
|
||||
const [editSpeakerTargetId, setEditSpeakerTargetId] = useState<number>(0)
|
||||
const [editSpeakerTargetName, setEditSpeakerTargetName] = useState<string>("")
|
||||
|
||||
useEffect(() => {
|
||||
const src = props.clientState.clientSetting.setting.correspondences?.find(x => {
|
||||
return x.sid == props.clientState.serverSetting.setting.srcId
|
||||
})
|
||||
const dst = props.clientState.clientSetting.setting.correspondences?.find(x => {
|
||||
return x.sid == props.clientState.serverSetting.setting.dstId
|
||||
})
|
||||
const recommendedF0Factor = dst && src ? dst.correspondence / src.correspondence : 0
|
||||
props.clientState.serverSetting.setF0Factor(recommendedF0Factor)
|
||||
|
||||
}, [props.clientState.serverSetting.setting.srcId, props.clientState.serverSetting.setting.dstId])
|
||||
|
||||
const srcIdRow = useMemo(() => {
|
||||
const selected = props.clientState.clientSetting.setting.correspondences?.find(x => {
|
||||
return x.sid == props.clientState.serverSetting.setting.srcId
|
||||
@ -132,7 +144,7 @@ export const useSpeakerSetting = (props: UseSpeakerSettingProps) => {
|
||||
<input type="range" className="body-item-input-slider" min="0.1" max="5.0" step="0.1" value={props.clientState.serverSetting.setting.f0Factor} onChange={(e) => {
|
||||
props.clientState.serverSetting.setF0Factor(Number(e.target.value))
|
||||
}}></input>
|
||||
<span className="body-item-input-slider-val">{props.clientState.serverSetting.setting.f0Factor}</span>
|
||||
<span className="body-item-input-slider-val">{props.clientState.serverSetting.setting.f0Factor.toFixed(1)}</span>
|
||||
</div>
|
||||
<div className="body-item-text"></div>
|
||||
<div className="body-item-text">recommend: {recommendedF0Factor.toFixed(1)}</div>
|
||||
|
Loading…
Reference in New Issue
Block a user