from gtts import gTTS
import os
import random
with open('symbols.txt', 'r') as file:
symbols = file.read().replace('\n', '')
def getunique():
for r, d, f in os.walk(path):
for file in f:
if file.endswith('.mp3'):
unique.add(file.split('.')[0])
def generate(unique):
chars = symbols
while True:
value = "".join(random.choice(chars) for _ in range(8))
if value not in unique:
language = 'en'
myobj = gTTS(text=value, lang=language, slow=True)
myobj.save("audio_captcha_training_set2/"+value+".mp3")
unique.add(value)
break
path = "C:\\Users\\DNS\\Desktop\\Audio Captcha\\Test Python code\\audio_captcha_training_set\\"
unique = set()
getunique()
for _ in range(20):
generate(unique)
Here is a code which reads a file in which there is characters from 0-9 and A-Z. This is generating audio for random 8 characters reading from file but it does not give any pause or delay while generating audio of characters. I want to add a pause of a second between each characters. Any help?