-
-
Notifications
You must be signed in to change notification settings - Fork 349
added text to speech feature #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,13 @@ | ||||||||||||||||||||||||||||||||
import pyttsx3 | ||||||||||||||||||||||||||||||||
default_SpeechRate= 176 | ||||||||||||||||||||||||||||||||
engine = pyttsx3.init() | ||||||||||||||||||||||||||||||||
voices = engine.getProperty("voices") | ||||||||||||||||||||||||||||||||
for voice in voices: | ||||||||||||||||||||||||||||||||
print(voice.id) | ||||||||||||||||||||||||||||||||
print(voice.name) | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
desired_voice_id = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_DAVID_11.0" | ||||||||||||||||||||||||||||||||
engine.setProperty(voice, desired_voice_id) | ||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The first argument should be the string 'voice', not the variable 'voice' from the loop. This should be engine.setProperty('voice', desired_voice_id).
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The hardcoded Windows registry path makes this code platform-specific and non-portable. Consider using a cross-platform approach or making the voice selection configurable.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||||||||||||||||||||
engine.setProperty("rate",default_SpeechRate) | ||||||||||||||||||||||||||||||||
engine.say("hello world") | ||||||||||||||||||||||||||||||||
engine.runAndWait() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The voice iteration loop prints all available voices but doesn't serve a clear purpose in the final implementation. Consider removing this debug code or making it conditional.
Copilot uses AI. Check for mistakes.