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

GTTS is adding in a word when speaking. #447

Closed
2 tasks done
dermotgouk opened this issue Jan 6, 2024 · 1 comment
Closed
2 tasks done

GTTS is adding in a word when speaking. #447

dermotgouk opened this issue Jan 6, 2024 · 1 comment

Comments

@dermotgouk
Copy link

dermotgouk commented Jan 6, 2024

Prerequisites

  • Did you make sure a similar issue didn't exist?
  • Did you update gTTS to the latest? (pip install --upgrade gTTS)

Current Behaviour (steps to reproduce)

GTTS is speaking the following sentence and after the number 4 its adding a word that sounds like feat/feed/feet
('Space 4 ', 'RS027', 'Operational', 'Space 4 ')

                finished = ("Space 4","RS027","Operational","Space 4")
                finishing =str(finished)
                print(finishing)
                var= gTTS(text = finishing,lang = 'en') 
                var.save('eng.mp3')

Expected Behaviour

It should not add this additional word afterwards

code

Context

Space 4 is called from a variable which parses an array list for the index.

Environment

  • gTTS version: 2.3.1
  • Operating System version: Windows 10
@pndurette
Copy link
Owner

pndurette commented Jan 7, 2024

@dermotgouk Ah, I see why.

So when you're transforming your tuple to string (with str(finished)), it actually creates the string ('Space 4', 'RS027', 'Operational', 'Space 4')

The last ' is read like "feet" as in the imperial measurement, most likely because this is how Google reads ' when it comes after a number, e.g. 6' (six feet). It does the same on the first space 4 in the string as well.

If you really want it to read a list verbatim, I'd use a join(), i.e.:

finished = ("Space 4", "RS027", "Operational", "Space")
- finishing = str(finished)
+ finishing = ", ".join(finished)
print(finishing)
var = gTTS(text=finishing, lang="en")
var.save("eng.mp3")

That way it'll read Space 4, RS027, Operational, Space 4

@pndurette pndurette closed this as not planned Won't fix, can't repro, duplicate, stale Jan 14, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants