Thursday, January 28, 2021

GUI for Google's text-to-speech service

In my course to overcome my dislike for GUI programming, I have been trying out different GUI frameworks. And the best way is to actually make something.

So I used the Google Text to Speech example in PySimpleGUI, and modified it. Here is the link to my repository for the gtts-gui.

 
You can now select the language and even speed up the speech a bit. The original speech playback speed can be a bit slow, so I added options for 1.25 and 1.5 times of the original speed. I have tried out various languages like Japanese, Chinese, Thai, Korean, and French. A simple test is to enter "1 2 3 4 5" for the text, then select the language you want. You can then hear playback of the numbers in different languages.


PySimpleGUI is declarative, like tkinter. To people who are used to object-oriented programming for GUI, this can be a significant difference. What is good about the declarative approach is that it is simple. A simple GUI can be quickly pieced together with a few lines of code. Is this better than an object-oriented framework, like Kivy? Actually, I think they are all just tools. You use the tool that best fits the job.

Update February 6, 2021: Added an improved version of the GUI that allows voice input using the SpeechRecognition Python package.



No comments: