Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

話者の最適なピッチ範囲に限定できるように #1942

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openapi.json

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions src/components/Dialog/SettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,34 @@
>
</QToggle>
</QCardActions>
<!-- Optimal Pitch Setting -->
<QCardActions class="q-px-md bg-surface">
<div>最適ピッチ</div>
<div
aria-label="ONの場合、イントネーションの調整可能の範囲を
スタイルごとの最適なピッチ範囲に限定します。"
>
<QIcon name="help_outline" size="sm" class="help-hover-icon">
<QTooltip
:delay="500"
anchor="center right"
self="center left"
transition-show="jump-right"
transition-hide="jump-left"
>
ONの場合、イントネーションの調整可能の範囲をスタイルごとの最適なピッチ範囲に限定します。
</QTooltip>
</QIcon>
</div>
<QSpace />
<QToggle
:model-value="experimentalSetting.enableOptimalPitchRange"
@update:model-value="
changeExperimentalSetting('enableOptimalPitchRange', $event)
"
>
</QToggle>
</QCardActions>
</QCard>
<QCard flat class="setting-card">
<QCardActions>
Expand Down
54 changes: 50 additions & 4 deletions src/components/Talk/AccentPhrase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,19 @@
</template>

<script setup lang="ts">
import { computed, ref } from "vue";
import { computed, onUpdated, ref, watchEffect } from "vue";

Check warning on line 209 in src/components/Talk/AccentPhrase.vue

View workflow job for this annotation

GitHub Actions / lint

'watchEffect' is defined but never used

Check warning on line 209 in src/components/Talk/AccentPhrase.vue

View workflow job for this annotation

GitHub Actions / build-test

'watchEffect' is defined but never used
import AudioAccent from "./AudioAccent.vue";
import AudioParameter from "./AudioParameter.vue";
import { MenuItemButton } from "@/components/Menu/type";
import ContextMenu from "@/components/Menu/ContextMenu.vue";
import { useStore } from "@/store";
import { AudioKey, MoraDataType } from "@/type/preload";
import {
AudioKey,
EngineId,
MoraDataType,
StyleId,
optimalPitchRangeItem,
} from "@/type/preload";
import { Mora } from "@/openapi/models/Mora";
import { AccentPhrase } from "@/openapi";

Expand Down Expand Up @@ -365,8 +371,10 @@
props.accentPhrase.moras.map((mora) => mora.pitch)
);

const maxPitch = 6.5;
const minPitch = 3;
const defaultMaxPitch = 6.5;
const defaultMinPitch = 3;
const maxPitch = ref(defaultMaxPitch);
const minPitch = ref(defaultMinPitch);
const maxMoraLength = 0.3;
const minMoraLength = 0;
const changeMoraData = (
Expand Down Expand Up @@ -414,6 +422,44 @@
changeMoraData(moraIndex, data, "voicing");
}
};

const fetchPitchRange = async (engineId: EngineId, styleId: StyleId) => {
store
.dispatch("LOAD_OPTIMAL_PITCH_RANGE", {
engineId,
styleId,
})
.then((optimalPitchRange) => {
if (!optimalPitchRange) return;
setMinMaxPitch(optimalPitchRange);
});
};

const setMinMaxPitch = (pitchRange: optimalPitchRangeItem) => {
maxPitch.value = pitchRange.high;
minPitch.value = pitchRange.low;
};

onUpdated(() => {
// This code runs everytime the line is switched, there should be a more optimal way
// but I'm too lazy to find it
if (store.state.experimentalSetting.enableOptimalPitchRange) {
const audioItem = store.state.audioItems[props.audioKey];
const engineId = audioItem.voice.engineId;
const styleId = audioItem.voice.styleId;
try {
const pitchRange = store.state.optimalPitchRange[engineId][styleId];
setMinMaxPitch(pitchRange);
} catch (error) {
fetchPitchRange(engineId, styleId);
}
} else {
setMinMaxPitch({
low: defaultMinPitch,
high: defaultMaxPitch,
});
}
});
</script>

<style scoped lang="scss">
Expand Down
2 changes: 2 additions & 0 deletions src/openapi/.openapi-generator/FILES

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 60 additions & 4 deletions src/openapi/apis/DefaultApi.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions src/openapi/models/Speaker.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions src/openapi/models/SpeakerOptimalPitchRangeItem.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading