Skip to content

Commit

Permalink
pyworld を 必要なAPIでのみインポートするように (#203)
Browse files Browse the repository at this point in the history
* pyworld を 必要なAPIでのみインポートするように

* fix pysen
  • Loading branch information
raa0121 authored Nov 27, 2021
1 parent d03dd5a commit 8465e98
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
)
Expand Down Expand Up @@ -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の範囲で指定してください"
Expand Down

0 comments on commit 8465e98

Please sign in to comment.