From 8465e984b207c9d9acb1f2bb2798c2a28fb2fdfb Mon Sep 17 00:00:00 2001 From: raa0121 Date: Sat, 27 Nov 2021 22:38:23 +0900 Subject: [PATCH] =?UTF-8?q?pyworld=20=E3=82=92=20=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E3=81=AAAPI=E3=81=A7=E3=81=AE=E3=81=BF=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=83=9D=E3=83=BC=E3=83=88=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=20(#203)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * pyworld を 必要なAPIでのみインポートするように * fix pysen --- run.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/run.py b/run.py index 56a95e294..b04afc11d 100644 --- a/run.py +++ b/run.py @@ -10,7 +10,6 @@ from typing import List, Optional import numpy as np -import pyworld as pw import soundfile import uvicorn from fastapi import FastAPI, HTTPException, Request, Response @@ -129,6 +128,8 @@ def create_accent_phrases(text: str, speaker_id: int) -> List[AccentPhrase]: def synthesis_world_params( query: AudioQuery, base_speaker: int, target_speaker: int ): + import pyworld as pw + base_wave = engine.synthesis(query=query, speaker_id=base_speaker).astype( "float" ) @@ -404,6 +405,8 @@ def synthesis_morphing( モーフィングの割合は`morph_rate`で指定でき、0.0でベースの話者、1.0でターゲットの話者に近づきます。 """ + import pyworld as pw + if morph_rate < 0.0 or morph_rate > 1.0: raise HTTPException( status_code=422, detail="morph_rateは0.0から1.0の範囲で指定してください"