TTS-ka 0.1.0__py3-none-any.whl

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.
TTS_ka/__init__.py ADDED
File without changes
TTS_ka/main.py ADDED
@@ -0,0 +1,92 @@
1
+ import os
2
+ import time
3
+ # import pygame
4
+ from tkinter import Tk # Python 3
5
+
6
+
7
+ # get args from command line to select voice
8
+ # voice = sys.argv[1]
9
+ # example of usege python main.py en-US-SteffanNeural
10
+ # accepted arguments are:
11
+ accepted_voices = [
12
+ 'ka-GE-EkaNeural',
13
+ 'en-US-SteffanNeural',
14
+ 'ru-RU-DariyaNeural',
15
+ 'en-GB-SoniaNeural',
16
+ ]
17
+
18
+
19
+ voice = 'en-GB-SoniaNeural'
20
+
21
+ if len(os.sys.argv) > 1:
22
+ lang = os.sys.argv[1]
23
+ if lang == 'ka':
24
+ voice = 'ka-GE-EkaNeural'
25
+ elif lang == 'en':
26
+ voice = 'en-GB-SoniaNeural'
27
+ elif lang == 'ru':
28
+ voice = 'ru-RU-SvetlanaNeural'
29
+ elif lang == 'en-US':
30
+ voice = 'en-US-SteffanNeural'
31
+ else:
32
+ print('Unknown language')
33
+ print('Accepted languages are: ka, en, ru, en-US')
34
+ exit(1)
35
+
36
+
37
+
38
+
39
+
40
+ def speak(data):
41
+ # check if data has some text init
42
+ if not data:
43
+ return
44
+ # replace special chars and new lines
45
+ data = data.replace('"', "'")
46
+ data = data.replace('\n', ' ')
47
+ data = data.replace('\r', ' ')
48
+ data = data.replace('\t', ' ')
49
+
50
+
51
+ command = f'edge-tts --voice "{voice}" --text "{data}" --write-media "data.mp3"'
52
+ # print(command)
53
+ return_code = os.system(command)
54
+ # Wait for command to finish
55
+
56
+
57
+ print("Generating audio file in path {}\\data.mp3".format(os.path.abspath(os.getcwd())))
58
+
59
+ if return_code != 0:
60
+ print("Error")
61
+ return
62
+ else:
63
+ print("Audio file ready.")# Wait for 1 second before checking again
64
+
65
+ # open audio file and play it
66
+ os.system("data.mp3")
67
+
68
+
69
+ # read txt and put it in a speak function
70
+ def read_txt(book_name="data.txt"):
71
+ with open(book_name, 'r', encoding="utf-8") as f:
72
+ print("Reading...")
73
+ data = f.read()
74
+ print(data[0:100])
75
+ if data:
76
+ speak(data)
77
+
78
+ def write_txt(data):
79
+ with open("data.txt", 'w', encoding='utf-8') as f:
80
+ f.write(data)
81
+
82
+
83
+ def tts(data = Tk().clipboard_get()):
84
+ if data:
85
+ write_txt(data)
86
+ read_txt()
87
+ else:
88
+ speak("Nothing to read")
89
+
90
+ if __name__ == "__main__":
91
+ # read_txt()
92
+ tts()
File without changes
@@ -0,0 +1,43 @@
1
+ Metadata-Version: 2.2
2
+ Name: TTS_ka
3
+ Version: 0.1.0
4
+ Summary: A simple text to speech program using edge-tts library
5
+ Author-email: David Chincharashvili <davidchincharashvili@gmail.com>
6
+ Project-URL: Homepage, https://github.com/DavidTbilisi/TTS.git
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.6
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: edge-tts
14
+
15
+ # Text to Speech
16
+ This is a simple text to speech program that uses the `edge-tts` library to convert text to speech.
17
+
18
+ ## Languages Supported
19
+ - Georgian
20
+ - English
21
+ - Russian
22
+
23
+ ## Requirements
24
+ - [Python 3.6 or higher](https://www.python.org/downloads/)
25
+
26
+ ## Installation and Usage
27
+ 1. Install the package from PyPI:
28
+ ```sh
29
+ pip install text-to-speech
30
+ ```
31
+ 2. Use the package in your Python code:
32
+ ```python
33
+ from text_to_speech import text_to_speech
34
+
35
+ text = "Hello, this is a text to speech conversion."
36
+ text_to_speech(text, 'en')
37
+ ```
38
+
39
+ ## Running Tests
40
+ To run the tests, navigate to the `tests` directory and execute:
41
+ ```sh
42
+ python -m unittest discover
43
+ ```
@@ -0,0 +1,7 @@
1
+ TTS_ka/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ TTS_ka/main.py,sha256=GT1q5UY9lgi28NpG3Pt0jdSGg8TUST96FAUnIYagQ5g,2186
3
+ TTS_ka-0.1.0.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ TTS_ka-0.1.0.dist-info/METADATA,sha256=IhxWiOpuZOD7FRRjzUpCGdvpn5GWg8ODn8pzadqTPz0,1223
5
+ TTS_ka-0.1.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
6
+ TTS_ka-0.1.0.dist-info/top_level.txt,sha256=vP1l-9h7OPV0BqvX206OMR2rgV1wvxG5YZUK6w6HdCk,7
7
+ TTS_ka-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.8.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ TTS_ka