From 8fd8a3a64a02054511fa2538307445296750e239 Mon Sep 17 00:00:00 2001 From: Abhilash Date: Tue, 15 Apr 2025 22:55:02 +0530 Subject: [PATCH 1/2] added text to speech feature --- text_to_speech.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 text_to_speech.py diff --git a/text_to_speech.py b/text_to_speech.py new file mode 100644 index 0000000..be257c6 --- /dev/null +++ b/text_to_speech.py @@ -0,0 +1,13 @@ +import pyttsx3 + +engine =pyttsx3.init() +voices= engine.getProperty("voices") +for i in voices: + print(i.id) + print(i.name) + +id ="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_DAVID_11.0" +engine.setProperty(i, id) +engine.setProperty("rate",176) +engine.say("hello world") +engine.runAndWait() \ No newline at end of file From 6750246c6495b90855b3fe0388ed622841dd3e36 Mon Sep 17 00:00:00 2001 From: "L. Abhilash" <160405976+LAbhilashKumar@users.noreply.github.com> Date: Sun, 27 Jul 2025 13:33:29 +0530 Subject: [PATCH 2/2] Update text_to_speech.py --- text_to_speech.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/text_to_speech.py b/text_to_speech.py index be257c6..369c9bc 100644 --- a/text_to_speech.py +++ b/text_to_speech.py @@ -1,13 +1,13 @@ import pyttsx3 +default_SpeechRate= 176 +engine = pyttsx3.init() +voices = engine.getProperty("voices") +for voice in voices: + print(voice.id) + print(voice.name) -engine =pyttsx3.init() -voices= engine.getProperty("voices") -for i in voices: - print(i.id) - print(i.name) - -id ="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_DAVID_11.0" -engine.setProperty(i, id) -engine.setProperty("rate",176) +desired_voice_id = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_DAVID_11.0" +engine.setProperty(voice, desired_voice_id) +engine.setProperty("rate",default_SpeechRate) engine.say("hello world") -engine.runAndWait() \ No newline at end of file +engine.runAndWait()