From a6450b13d9ab827546e566fcb2443ddadc787eb8 Mon Sep 17 00:00:00 2001
From: Ryo Yamashita <qryxip@gmail.com>
Date: Wed, 30 Oct 2024 23:45:55 +0900
Subject: [PATCH] =?UTF-8?q?fix:=20Python=20API=E3=81=A8example/python/run.?=
 =?UTF-8?q?py=E3=81=AE=E5=9E=8B=E4=BB=98=E3=81=91=E3=82=92=E7=9B=B4?=
 =?UTF-8?q?=E3=81=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../python/voicevox_core/_rust/blocking.pyi    | 18 ++++++++++++++++++
 .../python/voicevox_core/blocking.py           | 10 +++++++++-
 example/python/run.py                          |  2 +-
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/crates/voicevox_core_python_api/python/voicevox_core/_rust/blocking.pyi b/crates/voicevox_core_python_api/python/voicevox_core/_rust/blocking.pyi
index cf4f1f5c6..9d73c032b 100644
--- a/crates/voicevox_core_python_api/python/voicevox_core/_rust/blocking.pyi
+++ b/crates/voicevox_core_python_api/python/voicevox_core/_rust/blocking.pyi
@@ -139,6 +139,12 @@ class OpenJtalk:
         """
         ...
 
+class AudioFeature:
+    @property
+    def frame_length(self) -> int: ...
+    @property
+    def frame_rate(self) -> float: ...
+
 class Synthesizer:
     """
     音声シンセサイザ。
@@ -351,6 +357,18 @@ class Synthesizer:
             スタイルID。
         """
         ...
+    def precompute_render(
+        self,
+        audio_query: AudioQuery,
+        style_id: Union[StyleId, int],
+        enable_interrogative_upspeak: bool = True,
+    ) -> AudioFeature: ...
+    def render(
+        self,
+        audio: AudioFeature,
+        start: int,
+        end: int,
+    ) -> bytes: ...
     def synthesis(
         self,
         audio_query: AudioQuery,
diff --git a/crates/voicevox_core_python_api/python/voicevox_core/blocking.py b/crates/voicevox_core_python_api/python/voicevox_core/blocking.py
index 01ea45029..631eb6a81 100644
--- a/crates/voicevox_core_python_api/python/voicevox_core/blocking.py
+++ b/crates/voicevox_core_python_api/python/voicevox_core/blocking.py
@@ -1,5 +1,6 @@
 # pyright: reportMissingModuleSource=false
 from ._rust.blocking import (
+    AudioFeature,
     Onnxruntime,
     OpenJtalk,
     Synthesizer,
@@ -7,4 +8,11 @@
     VoiceModelFile,
 )
 
-__all__ = ["Onnxruntime", "OpenJtalk", "Synthesizer", "UserDict", "VoiceModelFile"]
+__all__ = [
+    "AudioFeature",
+    "Onnxruntime",
+    "OpenJtalk",
+    "Synthesizer",
+    "UserDict",
+    "VoiceModelFile",
+]
diff --git a/example/python/run.py b/example/python/run.py
index 64a871bc2..17f7e688f 100644
--- a/example/python/run.py
+++ b/example/python/run.py
@@ -71,7 +71,7 @@ def main() -> None:
     logger.info("%s", f"Wrote `{out}`")
 
 
-def parse_args() -> Tuple[AccelerationMode, Path, str, Path, str, Path, int]:
+def parse_args() -> Tuple[AccelerationMode, Path, str, Path, str, Path, int, bool]:
     argparser = ArgumentParser()
     argparser.add_argument(
         "--mode",