-
Notifications
You must be signed in to change notification settings - Fork 57
/
aspeak.pyi
129 lines (116 loc) · 5.27 KB
/
aspeak.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
from typing import Any, Optional
class AudioFormat:
def __init__(
self, container: str = "mp3", quality: int = 0, use_closest: bool = False
) -> None:
"""
Create an audio format object.
Args:
container (Optional[str]): The container format for the audio. It can be either 'mp3', 'wav', 'ogg' or 'webm'.
quality (Optional[int]): The quality for the audio. Defaults to 0.
use_closest (Optional[bool]): Whether to use the closest quality if the specified quality does not exist. Defaults to False.
"""
AmrWb16000Hz: AudioFormat
Audio16Khz128KBitRateMonoMp3: AudioFormat
Audio16Khz16Bit32KbpsMonoOpus: AudioFormat
Audio16Khz32KBitRateMonoMp3: AudioFormat
Audio16Khz64KBitRateMonoMp3: AudioFormat
Audio24Khz160KBitRateMonoMp3: AudioFormat
Audio24Khz16Bit24KbpsMonoOpus: AudioFormat
Audio24Khz16Bit48KbpsMonoOpus: AudioFormat
Audio24Khz48KBitRateMonoMp3: AudioFormat
Audio24Khz96KBitRateMonoMp3: AudioFormat
Audio48Khz192KBitRateMonoMp3: AudioFormat
Audio48Khz96KBitRateMonoMp3: AudioFormat
Ogg16Khz16BitMonoOpus: AudioFormat
Ogg24Khz16BitMonoOpus: AudioFormat
Ogg48Khz16BitMonoOpus: AudioFormat
Raw16Khz16BitMonoPcm: AudioFormat
Raw16Khz16BitMonoTrueSilk: AudioFormat
Raw22050Hz16BitMonoPcm: AudioFormat
Raw24Khz16BitMonoPcm: AudioFormat
Raw24Khz16BitMonoTrueSilk: AudioFormat
Raw44100Hz16BitMonoPcm: AudioFormat
Raw48Khz16BitMonoPcm: AudioFormat
Raw8Khz16BitMonoPcm: AudioFormat
Raw8Khz8BitMonoALaw: AudioFormat
Raw8Khz8BitMonoMULaw: AudioFormat
Riff16Khz16BitMonoPcm: AudioFormat
Riff22050Hz16BitMonoPcm: AudioFormat
Riff24Khz16BitMonoPcm: AudioFormat
Riff44100Hz16BitMonoPcm: AudioFormat
Riff48Khz16BitMonoPcm: AudioFormat
Riff8Khz16BitMonoPcm: AudioFormat
Riff8Khz8BitMonoALaw: AudioFormat
Riff8Khz8BitMonoMULaw: AudioFormat
Webm16Khz16BitMonoOpus: AudioFormat
Webm24Khz16Bit24KbpsMonoOpus: AudioFormat
Webm24Khz16BitMonoOpus: AudioFormat
class Role:
Girl: Role
Boy: Role
YoungAdultFemale: Role
YoungAdultMale: Role
OlderAdultFemale: Role
OlderAdultMale: Role
SeniorFemale: Role
SeniorMale: Role
class SpeechService:
def __init__(self, audio_format: AudioFormat, **options: Any) -> None:
"""
Create a speech service object.
Args:
audio_format (AudioFormat): The audio format for the output audio.
Kwargs:
endpoint (Optional[str]): The endpoint for the speech service. You must specify this if do not specify the region.
region (Optional[str]): The region for the speech service.
mode (Optional[str]): The mode for the speech service. It can be either 'rest' or 'websocket'. Defaults to 'rest'.
In websocket mode, the websocket connection will be established when this object is created.
key (Optional[str]): The subscription key for the speech service.
token (Optional[str]): The auth token for the speech service.
proxy (Optional[str]): The proxy for the speech service. Only http/socks5 proxy servers are supported by now.
headers (Optional[Iterable[Tuple[str, str]]]): Additional request headers.
"""
def speak_text(self, text: str, **options: Any) -> None:
"""
Synthesize text to speech and output to speaker.
Args:
text (str): The text to synthesize.
Kwargs:
pitch (Optional[str]): The pitch for the speech.
rate (Optional[str]): The rate for the speech.
locale (Optional[str]): The locale for the speech.
voice (Optional[str]): The voice to be used. It takes precedence over locale.
style (Optional[str]): Speech style.
style_degree (Optional[float]): Speech style degree. It can be a float number between 0.01 and 2.
role (Optional[Role]): Speech role.
"""
def synthesize_text(self, text: str, **options: Any) -> Optional[bytes]:
"""
Synthesize text to speech.
Args:
text (str): The text to synthesize.
Kwargs:
output (Optional[str]): The output file path. If this argument is not specified, the audio data will be returned.
pitch (Optional[str]): The pitch for the speech.
rate (Optional[str]): The rate for the speech.
locale (Optional[str]): The locale for the speech.
voice (Optional[str]): The voice to be used. It takes precedence over locale.
style (Optional[str]): Speech style.
style_degree (Optional[float]): Speech style degree. It can be a float number between 0.01 and 2.
role (Optional[Role]): Speech role.
"""
def speak_ssml(self, ssml: str) -> None:
"""
Synthesize SSML to speech and output to speaker.
Args:
ssml (str): The SSML to synthesize.
"""
def synthesize_ssml(self, ssml: str, **options: Any) -> Optional[bytes]:
"""
Synthesize SSML to speech.
Args:
ssml (str): The SSML to synthesize.
Kwargs:
output (Optional[str]): The output file path. If this argument is not specified, the audio data will be returned.
"""