It seems like there is a limit on how much you can use Google Translate through gTTS in a single day, since Google doesn't want you to hammer on their servers too much. What could be some potential ideas about how I could go about converting a lot of text (a few hundred megabytes) to speech with the Google Translate voices without waiting years (literally)? Just looking for someone to point me in the right direction. Thanks!
Google Translate/gTTS Limit
1.2k views Asked by Robert At
2
There are 2 answers
0
frknltrk
On
here is a workaround:
from gtts import gTTS, gTTSError
for attempt in range(max_retries):
try:
tts = gTTS(text, lang=language)
tts.save(audio_file_path)
return audio_file_path
except gTTSError as e:
if "429 (Too Many Requests)" in str(e):
print(f"Rate limit hit, retrying in {retry_delay} seconds...")
time.sleep(retry_delay)
retry_delay *= 2 # Exponential backoff
else:
raise
except Exception as e:
raise # Re-raise any other exceptions
raise RuntimeError("Failed to convert text to speech after retries")
ref: https://github.com/frknltrk/gTTS/blob/19e3ad555f0fc0da6ae8ff70ff72f9e801ba0da9/main.py#L33
Related Questions in PYTHON
- How to store a date/time in sqlite (or something similar to a date)
- Instagrapi recently showing HTTPError and UnknownError
- How to Retrieve Data from an MySQL Database and Display it in a GUI?
- How to create a regular expression to partition a string that terminates in either ": 45" or ",", without the ": "
- Python Geopandas unable to convert latitude longitude to points
- Influence of Unused FFN on Model Accuracy in PyTorch
- Seeking Python Libraries for Removing Extraneous Characters and Spaces in Text
- Writes to child subprocess.Popen.stdin don't work from within process group?
- Conda has two different python binarys (python and python3) with the same version for a single environment. Why?
- Problem with add new attribute in table with BOTO3 on python
- Can't install packages in python conda environment
- Setting diagonal of a matrix to zero
- List of numbers converted to list of strings to iterate over it. But receiving TypeError messages
- Basic Python Question: Shortening If Statements
- Python and regex, can't understand why some words are left out of the match
Related Questions in TEXT-TO-SPEECH
- How to Text To Speech a IA text generation that is streaming response
- Scroll textView along Text-to-Speech speaking highlight word change
- Text to speech, how to fast forward and backward?
- TTS doesn't initialize in Android 11
- Crash at flutter_tts initialysation : java.lang.NoSuchMethodError: android.speech.tts.TextToSpeech.getDefaultVoice
- Merging 6 ONNX Models into One for Unity Barracuda
- An Approach for Object Distance-Size Detection
- I cannot implement Text to Speech in my Unity project for Android
- How to implement Google Text-to-Speech in reactjs
- use SeamlessM4Tv2Model, I want to slow down the rate of speech of audio output
- Voice change in react native TSS
- Pause Discrepencies In Azure Speech Studio and Speech SDK
- How can I make a Python script utilize Windows Narrator to read only specific text output?
- RuntimeError: size mismatch for embedding.weight in Tacotron2\inference.ipynb
- Is there a way to use the Narrator Voice(Windows Acessibility) on text-to-speech code?
Related Questions in GOOGLE-TRANSLATE
- Translating & Replacing Text Box Content From Spanish to English Using VBA (Excel Macro)
- While Trying to build a Language translator, Have Text_area which takes input On click of Translate button, Text area should show converted code
- Google Translate not translating without refreshing the page
- Use Google API Key to Translate Entire Website - Third party cookie will be blocked
- In Flutter App I want to implement translation using google translate api
- 'TextBlob' object has no attribute 'detect_language'
- Overlaid text on a .pdf translation
- How to fix a submit button on a form which is translated by Google?
- trying to use this python code i found online to translate images with Google Translate in bulk but keep getting the "No module named 'google' error"
- Problem showing output of translation (Google Translate API)
- Auto-translate using Python
- How to convert web page to a specific language automatically using Google TranslateElement?
- Pyspark - withColumn use googletranslate
- How do I translate Text in Images through Google Translate Without Extracting it? Python 3.X
- Is Google translate creating broken links on my website
Related Questions in GTTS
- How to fix the below mention error in python
- crossOrigin blocks requests for translate.google.com
- Does the text-to-speech demo on gcp work for SSML?
- ModuleNotFoundError: No module named 'gTTS'
- I can't convert my Text-To-Speech in Python 3.11
- SRT Subtitle Processing Using Autosub & Python: Trying to remove blank subtitle entries
- "I want to play received audio within my Node server without relying on external applications for playback, currently,
- I'm getting "None" in the config path, when trying to download the model, from CoquiTTS
- Trying to save audio to mp3, saving to wav instead
- not able to convert produce audio file in gradio
- How to save audio file in a folder and play it from there using gtts
- node gTTS how to increase the speed of generated output
- Change Gender Voice from Python gtts library
- How to fix audio file errors in python?
- use of Django-gTTS to say multiple text in one audio
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Use the Google Cloud TTS Service API instead.
There is a python interface, and a free tier is available.
https://cloud.google.com/text-to-speech/docs/create-audio#text-to-speech-text-python
https://cloud.google.com/text-to-speech/pricing
Alternatively, you can try using another library (like pyttsx3). But the quality is not as good.
Amazon Polly also has a similar service, through AWS, which a similar free tier, and a python interface.
https://docs.aws.amazon.com/polly/latest/dg/get-started-what-next.html
https://aws.amazon.com/polly/pricing/
I have used Polly in the past, but my free tier has expired (only good for 1 year). It takes a bit of work to set up, but once set up, it is fast and easy to use.
Good luck. (Though, by now, you might already have found a solution...)