diff --git a/crates/voicevox_core/src/engine/model.rs b/crates/voicevox_core/src/engine/model.rs index 4c7d5c8f8..3a46b14d4 100644 --- a/crates/voicevox_core/src/engine/model.rs +++ b/crates/voicevox_core/src/engine/model.rs @@ -84,10 +84,10 @@ pub struct AudioQuery { pub pause_length_scale: (), /// \[読み取り専用\] AquesTalk風記法。 /// - /// [`Synthesizer::audio_query`]が返すもののみ`Some`となる。入力としてのAudioQueryでは無視され + /// [`Synthesizer::create_audio_query`]が返すもののみ`Some`となる。入力としてのAudioQueryでは無視され /// る。 /// - /// [`Synthesizer::audio_query`]: crate::blocking::Synthesizer::audio_query + /// [`Synthesizer::create_audio_query`]: crate::blocking::Synthesizer::create_audio_query pub kana: Option, } diff --git a/crates/voicevox_core/src/synthesizer.rs b/crates/voicevox_core/src/synthesizer.rs index 1bec68d9f..31aec6b72 100644 --- a/crates/voicevox_core/src/synthesizer.rs +++ b/crates/voicevox_core/src/synthesizer.rs @@ -730,7 +730,7 @@ mod inner { } } - pub(super) async fn audio_query_from_kana( + pub(super) async fn create_audio_query_from_kana( &self, kana: &str, style_id: StyleId, @@ -745,7 +745,7 @@ mod inner { style_id: StyleId, options: &TtsOptions, ) -> Result> { - let audio_query = &self.audio_query_from_kana(kana, style_id).await?; + let audio_query = &self.create_audio_query_from_kana(kana, style_id).await?; self.synthesis(audio_query, style_id, &SynthesisOptions::from(options)) .await } @@ -761,7 +761,7 @@ mod inner { self.replace_mora_data(&accent_phrases, style_id).await } - pub(super) async fn audio_query( + pub(super) async fn create_audio_query( &self, text: &str, style_id: StyleId, @@ -776,7 +776,7 @@ mod inner { style_id: StyleId, options: &TtsOptions, ) -> Result> { - let audio_query = &self.audio_query(text, style_id).await?; + let audio_query = &self.create_audio_query(text, style_id).await?; self.synthesis(audio_query, style_id, &SynthesisOptions::from(options)) .await } @@ -1417,19 +1417,21 @@ pub(crate) mod blocking { /// # /// use voicevox_core::StyleId; /// - /// let audio_query = synthesizer.audio_query_from_kana("コンニチワ'", StyleId::new(302))?; + /// let audio_query = synthesizer.create_audio_query_from_kana("コンニチワ'", StyleId::new(302))?; /// # /// # Ok(()) /// # } /// ``` /// /// [AudioQuery]: crate::AudioQuery - pub fn audio_query_from_kana( + pub fn create_audio_query_from_kana( &self, kana: &str, style_id: StyleId, ) -> crate::Result { - self.0.audio_query_from_kana(kana, style_id).block_on() + self.0 + .create_audio_query_from_kana(kana, style_id) + .block_on() } /// AquesTalk風記法から音声合成を行う。 @@ -1497,15 +1499,19 @@ pub(crate) mod blocking { /// # /// use voicevox_core::StyleId; /// - /// let audio_query = synthesizer.audio_query("こんにちは", StyleId::new(302))?; + /// let audio_query = synthesizer.create_audio_query("こんにちは", StyleId::new(302))?; /// # /// # Ok(()) /// # } /// ``` /// /// [AudioQuery]: crate::AudioQuery - pub fn audio_query(&self, text: &str, style_id: StyleId) -> crate::Result { - self.0.audio_query(text, style_id).block_on() + pub fn create_audio_query( + &self, + text: &str, + style_id: StyleId, + ) -> crate::Result { + self.0.create_audio_query(text, style_id).block_on() } /// 日本語のテキストから音声合成を行う。 @@ -1784,7 +1790,7 @@ pub(crate) mod nonblocking { /// use voicevox_core::StyleId; /// /// let audio_query = synthesizer - /// .audio_query_from_kana("コンニチワ'", StyleId::new(302)) + /// .create_audio_query_from_kana("コンニチワ'", StyleId::new(302)) /// .await?; /// # /// # Ok(()) @@ -1792,12 +1798,12 @@ pub(crate) mod nonblocking { /// ``` /// /// [AudioQuery]: crate::AudioQuery - pub async fn audio_query_from_kana( + pub async fn create_audio_query_from_kana( &self, kana: &str, style_id: StyleId, ) -> Result { - self.0.audio_query_from_kana(kana, style_id).await + self.0.create_audio_query_from_kana(kana, style_id).await } /// AquesTalk風記法から音声合成を行う。 @@ -1862,7 +1868,7 @@ pub(crate) mod nonblocking { /// use voicevox_core::StyleId; /// /// let audio_query = synthesizer - /// .audio_query("こんにちは", StyleId::new(302)) + /// .create_audio_query("こんにちは", StyleId::new(302)) /// .await?; /// # /// # Ok(()) @@ -1870,8 +1876,12 @@ pub(crate) mod nonblocking { /// ``` /// /// [AudioQuery]: crate::AudioQuery - pub async fn audio_query(&self, text: &str, style_id: StyleId) -> Result { - self.0.audio_query(text, style_id).await + pub async fn create_audio_query( + &self, + text: &str, + style_id: StyleId, + ) -> Result { + self.0.create_audio_query(text, style_id).await } /// 日本語のテキストから音声合成を行う。 @@ -2151,7 +2161,7 @@ mod tests { "コ'レワ/テ_スト'デ_ス" )] #[tokio::test] - async fn audio_query_works( + async fn create_audio_query_works( #[case] input: Input, #[case] expected_text_consonant_vowel_data: &TextConsonantVowelData, #[case] expected_kana_text: &str, @@ -2176,10 +2186,10 @@ mod tests { let query = match input { Input::Kana(input) => { syntesizer - .audio_query_from_kana(input, StyleId::new(0)) + .create_audio_query_from_kana(input, StyleId::new(0)) .await } - Input::Japanese(input) => syntesizer.audio_query(input, StyleId::new(0)).await, + Input::Japanese(input) => syntesizer.create_audio_query(input, StyleId::new(0)).await, } .unwrap(); diff --git a/crates/voicevox_core_c_api/src/lib.rs b/crates/voicevox_core_c_api/src/lib.rs index 3f1ab4897..022ea1d52 100644 --- a/crates/voicevox_core_c_api/src/lib.rs +++ b/crates/voicevox_core_c_api/src/lib.rs @@ -757,7 +757,7 @@ pub unsafe extern "C" fn voicevox_synthesizer_create_audio_query_from_kana( let audio_query = synthesizer .body() - .audio_query_from_kana(kana, StyleId::new(style_id))?; + .create_audio_query_from_kana(kana, StyleId::new(style_id))?; let audio_query = CString::new(audio_query_model_to_json(&audio_query)) .expect("should not contain '\\0'"); output_audio_query_json @@ -806,7 +806,7 @@ pub unsafe extern "C" fn voicevox_synthesizer_create_audio_query( let audio_query = synthesizer .body() - .audio_query(text, StyleId::new(style_id))?; + .create_audio_query(text, StyleId::new(style_id))?; let audio_query = CString::new(audio_query_model_to_json(&audio_query)) .expect("should not contain '\\0'"); output_audio_query_json diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/blocking/Synthesizer.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/blocking/Synthesizer.java index 4b59529ee..43f5fd776 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/blocking/Synthesizer.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/blocking/Synthesizer.java @@ -115,7 +115,7 @@ public AudioQuery createAudioQueryFromKana(String kana, int styleId) throws RunM if (!Utils.isU32(styleId)) { throw new IllegalArgumentException("styleId"); } - String queryJson = rsAudioQueryFromKana(kana, styleId); + String queryJson = rsCreateAudioQueryFromKana(kana, styleId); Gson gson = new Gson(); AudioQuery audioQuery = gson.fromJson(queryJson, AudioQuery.class); @@ -138,7 +138,7 @@ public AudioQuery createAudioQuery(String text, int styleId) throws RunModelExce if (!Utils.isU32(styleId)) { throw new IllegalArgumentException("styleId"); } - String queryJson = rsAudioQuery(text, styleId); + String queryJson = rsCreateAudioQuery(text, styleId); Gson gson = new Gson(); AudioQuery audioQuery = gson.fromJson(queryJson, AudioQuery.class); @@ -300,10 +300,11 @@ public TtsConfigurator tts(String text, int styleId) { private native boolean rsIsLoadedVoiceModel(UUID voiceModelId); @Nonnull - private native String rsAudioQueryFromKana(String kana, int styleId) throws RunModelException; + private native String rsCreateAudioQueryFromKana(String kana, int styleId) + throws RunModelException; @Nonnull - private native String rsAudioQuery(String text, int styleId) throws RunModelException; + private native String rsCreateAudioQuery(String text, int styleId) throws RunModelException; @Nonnull private native String rsAccentPhrasesFromKana(String kana, int styleId) throws RunModelException; diff --git a/crates/voicevox_core_java_api/src/synthesizer.rs b/crates/voicevox_core_java_api/src/synthesizer.rs index 3487d3c50..0c60133da 100644 --- a/crates/voicevox_core_java_api/src/synthesizer.rs +++ b/crates/voicevox_core_java_api/src/synthesizer.rs @@ -183,7 +183,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_blocking_Synthesizer_rs // SAFETY: voicevox_core_java_apiを構成するライブラリの中に、これと同名のシンボルは存在しない #[unsafe(no_mangle)] -unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_blocking_Synthesizer_rsAudioQueryFromKana< +unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_blocking_Synthesizer_rsCreateAudioQueryFromKana< 'local, >( env: JNIEnv<'local>, @@ -202,7 +202,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_blocking_Synthesizer_rs .clone(); let audio_query = - internal.audio_query_from_kana(&kana, voicevox_core::StyleId::new(style_id))?; + internal.create_audio_query_from_kana(&kana, voicevox_core::StyleId::new(style_id))?; let query_json = serde_json::to_string(&audio_query).expect("should not fail"); @@ -214,7 +214,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_blocking_Synthesizer_rs // SAFETY: voicevox_core_java_apiを構成するライブラリの中に、これと同名のシンボルは存在しない #[unsafe(no_mangle)] -unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_blocking_Synthesizer_rsAudioQuery< +unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_blocking_Synthesizer_rsCreateAudioQuery< 'local, >( env: JNIEnv<'local>, @@ -232,7 +232,8 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_blocking_Synthesizer_rs )? .clone(); - let audio_query = internal.audio_query(&text, voicevox_core::StyleId::new(style_id))?; + let audio_query = + internal.create_audio_query(&text, voicevox_core::StyleId::new(style_id))?; let query_json = serde_json::to_string(&audio_query).expect("should not fail"); diff --git a/crates/voicevox_core_python_api/python/test/test_asyncio_user_dict_load.py b/crates/voicevox_core_python_api/python/test/test_asyncio_user_dict_load.py index b6fe50986..e433a7442 100644 --- a/crates/voicevox_core_python_api/python/test/test_asyncio_user_dict_load.py +++ b/crates/voicevox_core_python_api/python/test/test_asyncio_user_dict_load.py @@ -24,7 +24,7 @@ async def test_user_dict_load() -> None: await synthesizer.load_voice_model(model) - audio_query_without_dict = await synthesizer.audio_query( + audio_query_without_dict = await synthesizer.create_audio_query( "this_word_should_not_exist_in_default_dictionary", style_id=0 ) @@ -39,7 +39,7 @@ async def test_user_dict_load() -> None: await open_jtalk.use_user_dict(temp_dict) - audio_query_with_dict = await synthesizer.audio_query( + audio_query_with_dict = await synthesizer.create_audio_query( "this_word_should_not_exist_in_default_dictionary", style_id=0 ) assert audio_query_without_dict != audio_query_with_dict diff --git a/crates/voicevox_core_python_api/python/test/test_blocking_user_dict_load.py b/crates/voicevox_core_python_api/python/test/test_blocking_user_dict_load.py index e8a5bd350..9a51834f8 100644 --- a/crates/voicevox_core_python_api/python/test/test_blocking_user_dict_load.py +++ b/crates/voicevox_core_python_api/python/test/test_blocking_user_dict_load.py @@ -22,7 +22,7 @@ def test_user_dict_load() -> None: synthesizer.load_voice_model(model) - audio_query_without_dict = synthesizer.audio_query( + audio_query_without_dict = synthesizer.create_audio_query( "this_word_should_not_exist_in_default_dictionary", style_id=0 ) @@ -37,7 +37,7 @@ def test_user_dict_load() -> None: open_jtalk.use_user_dict(temp_dict) - audio_query_with_dict = synthesizer.audio_query( + audio_query_with_dict = synthesizer.create_audio_query( "this_word_should_not_exist_in_default_dictionary", style_id=0 ) assert audio_query_without_dict != audio_query_with_dict diff --git a/crates/voicevox_core_python_api/python/voicevox_core/_models.py b/crates/voicevox_core_python_api/python/voicevox_core/_models.py index 9af47148a..dc32558fb 100644 --- a/crates/voicevox_core_python_api/python/voicevox_core/_models.py +++ b/crates/voicevox_core_python_api/python/voicevox_core/_models.py @@ -218,8 +218,8 @@ class AudioQuery: """ [読み取り専用] AquesTalk風記法。 - :func:`Synthesizer.audio_query` が返すもののみ ``str`` となる。入力としてのAudioQueryでは無視さ - れる。 + :func:`Synthesizer.create_audio_query` が返すもののみ ``str`` となる。入力として + のAudioQueryでは無視される。 """ diff --git a/crates/voicevox_core_python_api/python/voicevox_core/_rust/asyncio.pyi b/crates/voicevox_core_python_api/python/voicevox_core/_rust/asyncio.pyi index d6359e038..4d665d1cc 100644 --- a/crates/voicevox_core_python_api/python/voicevox_core/_rust/asyncio.pyi +++ b/crates/voicevox_core_python_api/python/voicevox_core/_rust/asyncio.pyi @@ -218,7 +218,7 @@ class Synthesizer: モデルが読み込まれているかどうか。 """ ... - async def audio_query_from_kana( + async def create_audio_query_from_kana( self, kana: str, style_id: Union[StyleId, int], @@ -238,7 +238,7 @@ class Synthesizer: 話者とテキストから生成された :class:`AudioQuery` 。 """ ... - async def audio_query( + async def create_audio_query( self, text: str, style_id: Union[StyleId, int], 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 63111acfe..2db76bc7a 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 @@ -219,7 +219,7 @@ class Synthesizer: モデルが読み込まれているかどうか。 """ ... - def audio_query_from_kana( + def create_audio_query_from_kana( self, kana: str, style_id: Union[StyleId, int], @@ -239,7 +239,7 @@ class Synthesizer: 話者とテキストから生成された :class:`AudioQuery` 。 """ ... - def audio_query( + def create_audio_query( self, text: str, style_id: Union[StyleId, int], diff --git a/crates/voicevox_core_python_api/src/lib.rs b/crates/voicevox_core_python_api/src/lib.rs index 9f2a9e7e1..778e9c39d 100644 --- a/crates/voicevox_core_python_api/src/lib.rs +++ b/crates/voicevox_core_python_api/src/lib.rs @@ -572,7 +572,7 @@ mod blocking { .is_loaded_voice_model(voice_model_id.into())) } - fn audio_query_from_kana<'py>( + fn create_audio_query_from_kana<'py>( &self, kana: &str, style_id: u32, @@ -581,14 +581,14 @@ mod blocking { let synthesizer = self.synthesizer.read()?; let audio_query = synthesizer - .audio_query_from_kana(kana, StyleId::new(style_id)) + .create_audio_query_from_kana(kana, StyleId::new(style_id)) .into_py_result(py)?; let class = py.import("voicevox_core")?.getattr("AudioQuery")?; crate::convert::to_pydantic_dataclass(audio_query, class) } - fn audio_query<'py>( + fn create_audio_query<'py>( &self, text: &str, style_id: u32, @@ -597,7 +597,7 @@ mod blocking { let synthesizesr = self.synthesizer.read()?; let audio_query = synthesizesr - .audio_query(text, StyleId::new(style_id)) + .create_audio_query(text, StyleId::new(style_id)) .into_py_result(py)?; let class = py.import("voicevox_core")?.getattr("AudioQuery")?; @@ -1190,7 +1190,7 @@ mod asyncio { .is_loaded_voice_model(voice_model_id.into())) } - fn audio_query_from_kana<'py>( + fn create_audio_query_from_kana<'py>( &self, kana: &str, style_id: u32, @@ -1204,7 +1204,7 @@ mod asyncio { async move { let audio_query = synthesizer .read()? - .audio_query_from_kana(&kana, StyleId::new(style_id)) + .create_audio_query_from_kana(&kana, StyleId::new(style_id)) .await; Python::with_gil(|py| { @@ -1219,7 +1219,7 @@ mod asyncio { ) } - fn audio_query<'py>( + fn create_audio_query<'py>( &self, text: &str, style_id: u32, @@ -1233,7 +1233,7 @@ mod asyncio { async move { let audio_query = synthesizer .read()? - .audio_query(&text, StyleId::new(style_id)) + .create_audio_query(&text, StyleId::new(style_id)) .await; Python::with_gil(|py| { diff --git a/docs/guide/user/usage.md b/docs/guide/user/usage.md index 26ed50810..5038b31b4 100644 --- a/docs/guide/user/usage.md +++ b/docs/guide/user/usage.md @@ -120,7 +120,7 @@ with VoiceModelFile.open("model/0.vvm") as model: ```python text = "サンプル音声です" style_id = 0 -audio_query = synthesizer.audio_query(text, style_id) +audio_query = synthesizer.create_audio_query(text, style_id) pprint(audio_query) ``` diff --git a/example/python/run-asyncio.py b/example/python/run-asyncio.py index a5321c94c..0d7460f90 100644 --- a/example/python/run-asyncio.py +++ b/example/python/run-asyncio.py @@ -102,7 +102,7 @@ async def main() -> None: await synthesizer.load_voice_model(model) logger.info("%s", f"Creating an AudioQuery from {args.text!r}") - audio_query = await synthesizer.audio_query(args.text, args.style_id) + audio_query = await synthesizer.create_audio_query(args.text, args.style_id) logger.info("%s", f"Synthesizing with {display_as_json(audio_query)}") wav = await synthesizer.synthesis(audio_query, args.style_id) diff --git a/example/python/run.py b/example/python/run.py index e7e353dc5..4a22e709c 100644 --- a/example/python/run.py +++ b/example/python/run.py @@ -106,7 +106,7 @@ def main() -> None: synthesizer.load_voice_model(model) logger.info("%s", f"Creating an AudioQuery from {args.text!r}") - audio_query = synthesizer.audio_query(args.text, args.style_id) + audio_query = synthesizer.create_audio_query(args.text, args.style_id) logger.info("%s", f"Synthesizing with {display_as_json(audio_query)}") if args.streaming: