yta-audio-narration 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yta_audio_narration-0.0.1/LICENSE +19 -0
- yta_audio_narration-0.0.1/PKG-INFO +27 -0
- yta_audio_narration-0.0.1/README.md +6 -0
- yta_audio_narration-0.0.1/pyproject.toml +37 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/__init__.py +3 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/consts.py +1 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/enums.py +377 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/narrator.py +552 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/voice.py +88 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/voices/__init__.py +0 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/voices/coqui.py +278 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/voices/google.py +266 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/voices/microsoft.py +209 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/voices/open_voice.py +348 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/voices/tetyys.py +263 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/voices/tiktok.py +232 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/voices/tortoise.py +217 -0
- yta_audio_narration-0.0.1/src/yta_audio_narration/voices/ttsmp3.py +266 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2018 The Python Packaging Authority
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: yta-audio-narration
|
3
|
+
Version: 0.0.1
|
4
|
+
Summary: Youtube Autonomous Audio Narration Module.
|
5
|
+
Author: danialcala94
|
6
|
+
Author-email: danielalcalavalera@gmail.com
|
7
|
+
Requires-Python: ==3.9
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
10
|
+
Requires-Dist: coqui-tts (>=0.25.3,<0.26.0)
|
11
|
+
Requires-Dist: gtts (>=2.5.1,<3.0.0)
|
12
|
+
Requires-Dist: pyttsx3 (>=2.90,<3.0)
|
13
|
+
Requires-Dist: yta_constants (>=0.0.1,<1.0.0)
|
14
|
+
Requires-Dist: yta_file (>=0.0.1,<1.0.0)
|
15
|
+
Requires-Dist: yta_file_downloader (>=0.0.1,<1.0.0)
|
16
|
+
Requires-Dist: yta_programming (>=0.0.1,<1.0.0)
|
17
|
+
Requires-Dist: yta_text (>=0.0.1,<1.0.0)
|
18
|
+
Requires-Dist: yta_validation (>=0.0.1,<1.0.0)
|
19
|
+
Description-Content-Type: text/markdown
|
20
|
+
|
21
|
+
# Youtube Autonomous Audio Narration Module
|
22
|
+
|
23
|
+
The Audio narration module.
|
24
|
+
|
25
|
+
Please, check the 'pyproject.toml' file to see the dependencies.
|
26
|
+
|
27
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
[project]
|
2
|
+
name = "yta-audio-narration"
|
3
|
+
version = "0.0.1"
|
4
|
+
description = "Youtube Autonomous Audio Narration Module."
|
5
|
+
authors = [
|
6
|
+
{name = "danialcala94",email = "danielalcalavalera@gmail.com"}
|
7
|
+
]
|
8
|
+
readme = "README.md"
|
9
|
+
requires-python = "==3.9"
|
10
|
+
dependencies = [
|
11
|
+
"yta_validation (>=0.0.1,<1.0.0)",
|
12
|
+
"yta_constants (>=0.0.1,<1.0.0)",
|
13
|
+
"yta_programming (>=0.0.1,<1.0.0)",
|
14
|
+
"yta_file (>=0.0.1,<1.0.0)",
|
15
|
+
"yta_text (>=0.0.1,<1.0.0)",
|
16
|
+
"yta_file_downloader (>=0.0.1,<1.0.0)",
|
17
|
+
# These 'torch' and 'torchaudio' are needed by, at
|
18
|
+
# least, the 'deepfilternet' (df) library, and it
|
19
|
+
# is also needed for the open_voice voice that has
|
20
|
+
# been commented
|
21
|
+
#"torch (>=2.3.0,<3.0.0)",
|
22
|
+
# Careful, 'coqui-tts' v0.26.0 drops Python 3.9
|
23
|
+
# support. Do we actually use it (?)
|
24
|
+
"coqui-tts (>=0.25.3,<0.26.0)",
|
25
|
+
"pyttsx3 (>=2.90,<3.0)",
|
26
|
+
"gtts (>=2.5.1,<3.0.0)",
|
27
|
+
]
|
28
|
+
|
29
|
+
[tool.poetry]
|
30
|
+
packages = [{include = "yta_audio_narration", from = "src"}]
|
31
|
+
|
32
|
+
[tool.poetry.group.dev.dependencies]
|
33
|
+
pytest = "^8.3.5"
|
34
|
+
|
35
|
+
[build-system]
|
36
|
+
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
37
|
+
build-backend = "poetry.core.masonry.api"
|
@@ -0,0 +1 @@
|
|
1
|
+
DEFAULT_VOICE = 'default'
|
@@ -0,0 +1,377 @@
|
|
1
|
+
from yta_constants.lang import Language
|
2
|
+
from yta_constants.enum import YTAEnum as Enum
|
3
|
+
from typing import Union
|
4
|
+
|
5
|
+
|
6
|
+
class NarrationLanguage(Enum):
|
7
|
+
"""
|
8
|
+
The languages available for voice narrations.
|
9
|
+
|
10
|
+
This list is based on the ISO-639 but not all
|
11
|
+
these languages are available for narrations
|
12
|
+
and also each narration engine has its own
|
13
|
+
languages available. This list is also manually
|
14
|
+
set in other libraries, so please ensure it
|
15
|
+
keeps updated.
|
16
|
+
"""
|
17
|
+
|
18
|
+
DEFAULT = 'default'
|
19
|
+
"""
|
20
|
+
This value has been created for those cases
|
21
|
+
in which there is a default language that is
|
22
|
+
being used in the situation we are handling.
|
23
|
+
|
24
|
+
Using this value will provide that default
|
25
|
+
language. For example, a Youtube video can
|
26
|
+
be in Turkish or in English as default,
|
27
|
+
depending on the author. Using this 'default'
|
28
|
+
value will ensure you obtain that Youtube
|
29
|
+
video because that default language will
|
30
|
+
always exist.
|
31
|
+
"""
|
32
|
+
ABKHAZIAN = Language.ABKHAZIAN.value
|
33
|
+
AFAR = Language.AFAR.value
|
34
|
+
AFRIKAANS = Language.AFRIKAANS.value
|
35
|
+
AKAN = Language.AKAN.value
|
36
|
+
ALBANIAN = Language.ALBANIAN.value
|
37
|
+
AMHARIC = Language.AMHARIC.value
|
38
|
+
ARABIC = Language.ARABIC.value
|
39
|
+
ARAGONESE = Language.ARAGONESE.value
|
40
|
+
ARMENIAN = Language.ARMENIAN.value
|
41
|
+
ASSAMESE = Language.ASSAMESE.value
|
42
|
+
AVARIC = Language.AVARIC.value
|
43
|
+
AVESTAN = Language.AVESTAN.value
|
44
|
+
AYMARA = Language.AYMARA.value
|
45
|
+
AZERBAIJANI = Language.AZERBAIJANI.value
|
46
|
+
BAMBARA = Language.BAMBARA.value
|
47
|
+
BASHKIR = Language.BASHKIR.value
|
48
|
+
BASQUE = Language.BASQUE.value
|
49
|
+
BELARUSIAN = Language.BELARUSIAN.value
|
50
|
+
BENGALI = Language.BENGALI.value
|
51
|
+
BISLAMA = Language.BISLAMA.value
|
52
|
+
BOSNIAN = Language.BOSNIAN.value
|
53
|
+
BRETON = Language.BRETON.value
|
54
|
+
BULGARIAN = Language.BULGARIAN.value
|
55
|
+
BURMESE = Language.BURMESE.value
|
56
|
+
CATALAN = Language.CATALAN.value
|
57
|
+
CHAMORRO = Language.CHAMORRO.value
|
58
|
+
CHECHEN = Language.CHECHEN.value
|
59
|
+
CHICHEWA = Language.CHICHEWA.value
|
60
|
+
CHINESE = Language.CHINESE.value
|
61
|
+
CHINESE_TRADITIONAL = Language.CHINESE_TRADITIONAL.value
|
62
|
+
# TODO: I think there are more complex values like
|
63
|
+
# this above, but they are not in the list
|
64
|
+
CHURCH_SLAVONIC = Language.CHURCH_SLAVONIC.value
|
65
|
+
CHUVASH = Language.CHUVASH.value
|
66
|
+
CORNISH = Language.CORNISH.value
|
67
|
+
CORSICAN = Language.CORSICAN.value
|
68
|
+
CREE = Language.CREE.value
|
69
|
+
CROATIAN = Language.CROATIAN.value
|
70
|
+
CZECH = Language.CZECH.value
|
71
|
+
DANISH = Language.DANISH.value
|
72
|
+
DIVEHI = Language.DIVEHI.value
|
73
|
+
DUTCH = Language.DUTCH.value
|
74
|
+
DZONGKHA = Language.DZONGKHA.value
|
75
|
+
ENGLISH = Language.ENGLISH.value
|
76
|
+
ESPERANTO = Language.ESPERANTO.value
|
77
|
+
ESTONIAN = Language.ESTONIAN.value
|
78
|
+
EWE = Language.EWE.value
|
79
|
+
FAROESE = Language.FAROESE.value
|
80
|
+
FIJIAN = Language.FIJIAN.value
|
81
|
+
FINNISH = Language.FINNISH.value
|
82
|
+
FRENCH = Language.FRENCH.value
|
83
|
+
WESTERN_FRISIAN = Language.WESTERN_FRISIAN.value
|
84
|
+
FULAH = Language.FULAH.value
|
85
|
+
GAELIC = Language.GAELIC.value
|
86
|
+
GALICIAN = Language.GALICIAN.value
|
87
|
+
GANDA = Language.GANDA.value
|
88
|
+
GEORGIAN = Language.GEORGIAN.value
|
89
|
+
GERMAN = Language.GERMAN.value
|
90
|
+
GREEK = Language.GREEK.value
|
91
|
+
KALAALLISUT = Language.KALAALLISUT.value
|
92
|
+
GUARANI = Language.GUARANI.value
|
93
|
+
GUJARATI = Language.GUJARATI.value
|
94
|
+
HAITIAN = Language.HAITIAN.value
|
95
|
+
HAUSA = Language.HAUSA.value
|
96
|
+
HEBREW = Language.HEBREW.value
|
97
|
+
HERERO = Language.HERERO.value
|
98
|
+
HINDI = Language.HINDI.value
|
99
|
+
HIRI_MOTU = Language.HIRI_MOTU.value
|
100
|
+
HUNGARIAN = Language.HUNGARIAN.value
|
101
|
+
ICELANDIC = Language.ICELANDIC.value
|
102
|
+
IDO = Language.IDO.value
|
103
|
+
IGBO = Language.IGBO.value
|
104
|
+
INDONESIAN = Language.INDONESIAN.value
|
105
|
+
INTERLINGUA = Language.INTERLINGUA.value
|
106
|
+
INTERLINGUE = Language.INTERLINGUE.value
|
107
|
+
INUKTITUT = Language.INUKTITUT.value
|
108
|
+
INUPIAQ = Language.INUPIAQ.value
|
109
|
+
IRISH = Language.IRISH.value
|
110
|
+
ITALIAN = Language.ITALIAN.value
|
111
|
+
JAPANESE = Language.JAPANESE.value
|
112
|
+
JAVANESE = Language.JAVANESE.value
|
113
|
+
KANNADA = Language.KANNADA.value
|
114
|
+
KANURI = Language.KANURI.value
|
115
|
+
KASHMIRI = Language.KASHMIRI.value
|
116
|
+
KAZAKH = Language.KAZAKH.value
|
117
|
+
CENTRAL_KHMER = Language.CENTRAL_KHMER.value
|
118
|
+
KIKUYU = Language.KIKUYU.value
|
119
|
+
KINYARWANDA = Language.KINYARWANDA.value
|
120
|
+
KYRGYZ = Language.KYRGYZ.value
|
121
|
+
KOMI = Language.KOMI.value
|
122
|
+
KONGO = Language.KONGO.value
|
123
|
+
KOREAN = Language.KOREAN.value
|
124
|
+
KUANYAMA = Language.KUANYAMA.value
|
125
|
+
KURDISH = Language.KURDISH.value
|
126
|
+
LAO = Language.LAO.value
|
127
|
+
LATIN = Language.LATIN.value
|
128
|
+
LATVIAN = Language.LATVIAN.value
|
129
|
+
LIMBURGAN = Language.LIMBURGAN.value
|
130
|
+
LINGALA = Language.LINGALA.value
|
131
|
+
LITHUANIAN = Language.LITHUANIAN.value
|
132
|
+
LUBA_KATANGA = Language.LUBA_KATANGA.value
|
133
|
+
LUXEMBOURGISH = Language.LUXEMBOURGISH.value
|
134
|
+
MACEDONIAN = Language.MACEDONIAN.value
|
135
|
+
MALAGASY = Language.MALAGASY.value
|
136
|
+
MALAY = Language.MALAY.value
|
137
|
+
MALAYALAM = Language.MALAYALAM.value
|
138
|
+
MALTESE = Language.MALTESE.value
|
139
|
+
MANX = Language.MANX.value
|
140
|
+
MAORI = Language.MAORI.value
|
141
|
+
MARATHI = Language.MARATHI.value
|
142
|
+
MARSHALLESE = Language.MARSHALLESE.value
|
143
|
+
MONGOLIAN = Language.MONGOLIAN.value
|
144
|
+
NAURU = Language.NAURU.value
|
145
|
+
NAVAJO = Language.NAVAJO.value
|
146
|
+
NORTH_NDEBELE = Language.NORTH_NDEBELE.value
|
147
|
+
SOUTH_NDEBELE = Language.SOUTH_NDEBELE.value
|
148
|
+
NDONGA = Language.NDONGA.value
|
149
|
+
NEPALI = Language.NEPALI.value
|
150
|
+
NORWEGIAN = Language.NORWEGIAN.value
|
151
|
+
NORWEGIAN_BOKMAL = Language.NORWEGIAN_BOKMAL.value
|
152
|
+
NORWEGIAN_NYNORSK = Language.NORWEGIAN_NYNORSK.value
|
153
|
+
OCCITAN = Language.OCCITAN.value
|
154
|
+
OJIBWA = Language.OJIBWA.value
|
155
|
+
ORIYA = Language.ORIYA.value
|
156
|
+
OROMO = Language.OROMO.value
|
157
|
+
OSSETIAN = Language.OSSETIAN.value
|
158
|
+
PALI = Language.PALI.value
|
159
|
+
PASHTO = Language.PASHTO.value
|
160
|
+
PERSIAN = Language.PERSIAN.value
|
161
|
+
POLISH = Language.POLISH.value
|
162
|
+
PORTUGUESE = Language.PORTUGUESE.value
|
163
|
+
PUNJABI = Language.PUNJABI.value
|
164
|
+
QUECHUA = Language.QUECHUA.value
|
165
|
+
ROMANIAN = Language.ROMANIAN.value
|
166
|
+
ROMANSH = Language.ROMANSH.value
|
167
|
+
RUNDI = Language.RUNDI.value
|
168
|
+
RUSSIAN = Language.RUSSIAN.value
|
169
|
+
NORTHERN_SAMI = Language.NORTHERN_SAMI.value
|
170
|
+
SAMOAN = Language.SAMOAN.value
|
171
|
+
SANGO = Language.SANGO.value
|
172
|
+
SANSKRIT = Language.SANSKRIT.value
|
173
|
+
SARDINIAN = Language.SARDINIAN.value
|
174
|
+
SERBIAN = Language.SERBIAN.value
|
175
|
+
SHONA = Language.SHONA.value
|
176
|
+
SINDHI = Language.SINDHI.value
|
177
|
+
SINHALA = Language.SINHALA.value
|
178
|
+
SLOVAK = Language.SLOVAK.value
|
179
|
+
SLOVENIAN = Language.SLOVENIAN.value
|
180
|
+
SOMALI = Language.SOMALI.value
|
181
|
+
SOUTHERN_SOTHO = Language.SOUTHERN_SOTHO.value
|
182
|
+
SPANISH = Language.SPANISH.value
|
183
|
+
SUNDANESE = Language.SUNDANESE.value
|
184
|
+
SWAHILI = Language.SWAHILI.value
|
185
|
+
SWATI = Language.SWATI.value
|
186
|
+
SWEDISH = Language.SWEDISH.value
|
187
|
+
TAGALOG = Language.TAGALOG.value
|
188
|
+
TAHITIAN = Language.TAHITIAN.value
|
189
|
+
TAJIK = Language.TAJIK.value
|
190
|
+
TAMIL = Language.TAMIL.value
|
191
|
+
TATAR = Language.TATAR.value
|
192
|
+
TELUGU = Language.TELUGU.value
|
193
|
+
THAI = Language.THAI.value
|
194
|
+
TIBETAN = Language.TIBETAN.value
|
195
|
+
TIGRINYA = Language.TIGRINYA.value
|
196
|
+
TONGA = Language.TONGA.value
|
197
|
+
TSONGA = Language.TSONGA.value
|
198
|
+
TSWANA = Language.TSWANA.value
|
199
|
+
TURKISH = Language.TURKISH.value
|
200
|
+
TURKMEN = Language.TURKMEN.value
|
201
|
+
TWI = Language.TWI.value
|
202
|
+
UIGHUR = Language.UIGHUR.value
|
203
|
+
UKRAINIAN = Language.UKRAINIAN.value
|
204
|
+
URDU = Language.URDU.value
|
205
|
+
UZBEK = Language.UZBEK.value
|
206
|
+
VENDA = Language.VENDA.value
|
207
|
+
VIETNAMESE = Language.VIETNAMESE.value
|
208
|
+
VOLAPUK = Language.VOLAPUK.value
|
209
|
+
WALLOON = Language.WALLOON.value
|
210
|
+
WELSH = Language.WELSH.value
|
211
|
+
WOLOF = Language.WOLOF.value
|
212
|
+
XHOSA = Language.XHOSA.value
|
213
|
+
SICHUAN_YI = Language.SICHUAN_YI.value
|
214
|
+
YIDDISH = Language.YIDDISH.value
|
215
|
+
YORUBA = Language.YORUBA.value
|
216
|
+
ZHUANG = Language.ZHUANG.value
|
217
|
+
ZULU = Language.ZULU.value
|
218
|
+
|
219
|
+
# Engine > Language > NarratorName > Speed | Emotion
|
220
|
+
|
221
|
+
class VoiceEmotion(Enum):
|
222
|
+
"""
|
223
|
+
The emotion to be transmited in the voice
|
224
|
+
narration.
|
225
|
+
"""
|
226
|
+
|
227
|
+
DEFAULT = 'default'
|
228
|
+
SAD = 'sad'
|
229
|
+
NORMAL = 'normal'
|
230
|
+
HAPPY = 'happy'
|
231
|
+
# TODO: Add more when available
|
232
|
+
|
233
|
+
class VoiceSpeed(Enum):
|
234
|
+
"""
|
235
|
+
The speed to be used within the voice narration.
|
236
|
+
"""
|
237
|
+
|
238
|
+
DEFAULT = 'default'
|
239
|
+
SLOW = 'slow'
|
240
|
+
NORMAL = 'normal'
|
241
|
+
FAST = 'fast'
|
242
|
+
# TODO: Add more when available
|
243
|
+
|
244
|
+
class VoicePitch(Enum):
|
245
|
+
"""
|
246
|
+
The pitch to be used within the voice narration.
|
247
|
+
"""
|
248
|
+
|
249
|
+
DEFAULT = 'default'
|
250
|
+
LOW = 'low'
|
251
|
+
NORMAL = 'normal'
|
252
|
+
HIGH = 'high'
|
253
|
+
# TODO: Add more when available
|
254
|
+
|
255
|
+
class VoiceNarrationEngine(Enum):
|
256
|
+
"""
|
257
|
+
The engines we have available for voice narration
|
258
|
+
generation.
|
259
|
+
"""
|
260
|
+
|
261
|
+
DEFAULT = 'default'
|
262
|
+
"""
|
263
|
+
When this option is provided, the system will
|
264
|
+
choose one of the available enum elements.
|
265
|
+
"""
|
266
|
+
COQUI = 'coqui'
|
267
|
+
GOOGLE = 'google'
|
268
|
+
MICROSOFT = 'microsoft'
|
269
|
+
OPEN_VOICE = 'open_voice'
|
270
|
+
TETYYS = 'tetyys'
|
271
|
+
TIKTOK = 'tiktok'
|
272
|
+
TORTOISE = 'tortoise'
|
273
|
+
TTSMP3 = 'ttsmp3'
|
274
|
+
|
275
|
+
def _get_engine(
|
276
|
+
self
|
277
|
+
) -> 'VoiceNarrationEngine':
|
278
|
+
"""
|
279
|
+
We turn the DEFAULT instance into a specific
|
280
|
+
one to simplify the way we handle the options.
|
281
|
+
|
282
|
+
For internal use only.
|
283
|
+
"""
|
284
|
+
return (
|
285
|
+
VoiceNarrationEngine.GOOGLE
|
286
|
+
if self is VoiceNarrationEngine.DEFAULT else
|
287
|
+
self
|
288
|
+
)
|
289
|
+
|
290
|
+
def get_voice_narrator_class(
|
291
|
+
self
|
292
|
+
# ) -> Union['CoquiVoiceNarrator', 'GoogleVoiceNarrator', 'MicrosoftVoiceNarrator', 'OpenVoiceVoiceNarrator', 'TetyysVoiceNarrator', 'TiktokVoiceNarrator', 'TortoiseVoiceNarrator', 'Ttsmp3VoiceNarrator']:
|
293
|
+
) -> Union['CoquiVoiceNarrator', 'GoogleVoiceNarrator', 'MicrosoftVoiceNarrator', 'TetyysVoiceNarrator', 'TiktokVoiceNarrator', 'TortoiseVoiceNarrator', 'Ttsmp3VoiceNarrator']:
|
294
|
+
"""
|
295
|
+
Get the VoiceNarrator class associated with this
|
296
|
+
enum instance.
|
297
|
+
"""
|
298
|
+
# from yta_audio.voice.generation.narrator import CoquiVoiceNarrator, GoogleVoiceNarrator, MicrosoftVoiceNarrator, OpenVoiceVoiceNarrator, TetyysVoiceNarrator, TiktokVoiceNarrator, TortoiseVoiceNarrator, Ttsmp3VoiceNarrator
|
299
|
+
from yta_audio.voice.generation.narrator import CoquiVoiceNarrator, GoogleVoiceNarrator, MicrosoftVoiceNarrator, TetyysVoiceNarrator, TiktokVoiceNarrator, TortoiseVoiceNarrator, Ttsmp3VoiceNarrator
|
300
|
+
|
301
|
+
engine = self._get_engine()
|
302
|
+
|
303
|
+
return {
|
304
|
+
VoiceNarrationEngine.GOOGLE: GoogleVoiceNarrator,
|
305
|
+
VoiceNarrationEngine.COQUI: CoquiVoiceNarrator,
|
306
|
+
VoiceNarrationEngine.MICROSOFT: MicrosoftVoiceNarrator,
|
307
|
+
# VoiceNarrationEngine.OPEN_VOICE: OpenVoiceVoiceNarrator,
|
308
|
+
VoiceNarrationEngine.TETYYS: TetyysVoiceNarrator,
|
309
|
+
VoiceNarrationEngine.TIKTOK: TiktokVoiceNarrator,
|
310
|
+
VoiceNarrationEngine.TORTOISE: TortoiseVoiceNarrator,
|
311
|
+
VoiceNarrationEngine.TTSMP3: Ttsmp3VoiceNarrator,
|
312
|
+
}[engine]
|
313
|
+
|
314
|
+
@property
|
315
|
+
def available_languages(
|
316
|
+
self
|
317
|
+
) -> list[NarrationLanguage]:
|
318
|
+
return self.get_voice_narrator_class().get_available_languages()
|
319
|
+
|
320
|
+
def is_language_valid(
|
321
|
+
self,
|
322
|
+
language: NarrationLanguage
|
323
|
+
) -> bool:
|
324
|
+
"""
|
325
|
+
Check if the given 'language' is accepted by
|
326
|
+
this engine.
|
327
|
+
"""
|
328
|
+
return NarrationLanguage.to_enum(language) in self.available_languages
|
329
|
+
|
330
|
+
def get_available_narrator_names(
|
331
|
+
self,
|
332
|
+
language: NarrationLanguage
|
333
|
+
) -> list[str]:
|
334
|
+
return self.get_voice_narrator_class().get_available_narrator_names(language)
|
335
|
+
|
336
|
+
def is_narrator_name_valid(
|
337
|
+
self,
|
338
|
+
language: NarrationLanguage,
|
339
|
+
narration_name: str
|
340
|
+
) -> bool:
|
341
|
+
return narration_name in self.get_available_narrator_names(language)
|
342
|
+
|
343
|
+
@property
|
344
|
+
def available_emotions(
|
345
|
+
self
|
346
|
+
) -> list[VoiceEmotion]:
|
347
|
+
return self.get_voice_narrator_class().get_available_emotions()
|
348
|
+
|
349
|
+
def is_emotion_valid(
|
350
|
+
self,
|
351
|
+
emotion: VoiceEmotion
|
352
|
+
) -> bool:
|
353
|
+
return VoiceEmotion.to_enum(emotion) in self.available_emotions
|
354
|
+
|
355
|
+
@property
|
356
|
+
def available_speeds(
|
357
|
+
self
|
358
|
+
) -> list[VoiceSpeed]:
|
359
|
+
return self.get_voice_narrator_class().get_available_speeds()
|
360
|
+
|
361
|
+
def is_speed_valid(
|
362
|
+
self,
|
363
|
+
speed: VoiceSpeed
|
364
|
+
) -> bool:
|
365
|
+
return VoiceSpeed.to_enum(speed) in self.available_speeds
|
366
|
+
|
367
|
+
@property
|
368
|
+
def available_pitches(
|
369
|
+
self
|
370
|
+
) -> list[VoicePitch]:
|
371
|
+
return self.get_voice_narrator_class().get_available_pitches()
|
372
|
+
|
373
|
+
def is_pitch_valid(
|
374
|
+
self,
|
375
|
+
pitch: VoicePitch
|
376
|
+
) -> bool:
|
377
|
+
return VoicePitch.to_enum(pitch) in self.available_pitches
|