Skip to content
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

Add TextToSpeech algorithm #6

Open
bogind opened this issue Jul 26, 2024 · 1 comment
Open

Add TextToSpeech algorithm #6

bogind opened this issue Jul 26, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@bogind
Copy link
Owner

bogind commented Jul 26, 2024

Add another algorithm to allow users to use their OS builtin voices to say input text

Using QtTextToSpeech.QTextToSpeech.
Input for algorithm in initial stage should be:

  • Text - string
  • Voice - selection of named QVoice from OS available voices
  • Volume - float between 0 and 1

Will have to check about options for:

  • Locale
  • Pitch
  • Rate

Might add this as another dialog to the toolbar as well, with a test button

Example base setup to speech:

from PyQt5.QtTextToSpeech import QTextToSpeech

engine = None
engineNames = QTextToSpeech.availableEngines()

if len(engineNames) > 0:
    engineName = engineNames[0]
    engine = QTextToSpeech(engineName)

voices = []

for voice in engine.availableVoices():
    voices.append(voice)
    
    
voice = voices[1]
engine.setVoice(voice)

details = {
    "voice_gender": voice.genderName(voice.gender()),
    "voice_age": voice.ageName(voice.age()),
    "locale": engine.locale().name()
    }

print(details)

# spaces between the letters make them spell out
text = "Q G I S sound effects is totally going to get text to speech"
engine.say(text)
@bogind bogind added the enhancement New feature or request label Jul 26, 2024
@bogind bogind self-assigned this Jul 26, 2024
@bogind
Copy link
Owner Author

bogind commented Jul 28, 2024

Available as of #8 and version 0.3

Further enhancements will need to include adjusting:

  • Pitch
  • Rate

At least on windows 11 there are still issues with identifying newer voices and locales, likely due to lack of SAPI support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant