Skip to content

Commit 5d0e8e2

Browse files
committed
Add support for katakana English and new audio query types in VOICEVOX client
1 parent 1c470a0 commit 5d0e8e2

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

vvclient/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ async def create_audio_query(
5656
params = {"text": text, "speaker": speaker}
5757
if core_version:
5858
params["core_version"] = core_version
59+
if not enable_katakana_english:
60+
params["enable_katakana_english"] = "false"
5961
return AudioQuery(self.http, await self.http.create_audio_query(params))
6062

6163
async def fetch_engine_version(self) -> str:

vvclient/http.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from .errors import NotFoundError, HTTPException
88
from .types import AudioQueryType
9+
from .types.sing import AudioQuery as SingAudioQueryType, RequestPostAudioQuery
910

1011

1112
class Route:
@@ -46,6 +47,11 @@ async def create_audio_query(
4647
) -> AudioQueryType:
4748
return await self.request(Route("POST", "/audio_query"), params=params)
4849

50+
async def create_sing_audio_query(
51+
self, params: Dict[str, Union[str, int]], payload: RequestPostAudioQuery
52+
) -> SingAudioQueryType:
53+
return await self.request(Route("POST", "/sing_audio_query"), params=params)
54+
4955
async def synthesis(
5056
self, params: Dict[str, Union[str, int]], audio_query: AudioQueryType
5157
) -> bytes:

vvclient/types/sing/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .audio_query import *

vvclient/types/sing/audio_query.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from typing import TypedDict, List
2+
3+
4+
class Note(TypedDict):
5+
id: str
6+
key: int
7+
frame_length: int
8+
lyric: str
9+
10+
11+
class RequestPostAudioQuery(TypedDict):
12+
notes: List[Note]
13+
14+
15+
class Phoneme(TypedDict):
16+
phoneme: str
17+
frame_length: int
18+
note_id: str
19+
20+
21+
class AudioQuery(TypedDict):
22+
f0: List[int]
23+
volume: List[int]
24+
phonemes: List[Phoneme]
25+
volumeScale: int
26+
outputSamplingRate: int
27+
outputStereo: bool

0 commit comments

Comments
 (0)