Esempio n. 1
0
def iot(url):
    response = requests.get(url)
    print(response.text)
    myaud=gtts(text=str(response.text),lang='en-uk',slow=False)
    name=random.randint(1,10000000)
    myaud.save(str(name) +".mp3")
    playsound.playsound(str(name) +".mp3")
Esempio n. 2
0
def generate_audio(text):
    tts = gtts(text=text, lang=lang.code, slow=False)
    assets_path = '../client/src/assets/audio/'
    file_name = text + ".mp3"
    folder_path = assets_path + name + "/" + file_name

    tts.save(folder_path)
Esempio n. 3
0
def speak(audio_string):
    tts = gtts(text=audio_string, lang='en')
    r = random.randint(1,20000000)
    audio_file = 'audio' + str(r) + '.mp3'
    tts.save(audio_file)
    playsound.playsound(audio_file) 
    print(f"devpro: {audio_string}")
    os.remove(audio_file)
Esempio n. 4
0
async def say(ctx, *, text):
    message = gtts(text)
    message.save('tts.mp3')
    channel = ctx.message.channel
    user = ctx.message.author
    if user.voice is None:
        await channel.send('Join a voice channel first')
        return
    voice_channel = user.voice.channel
    try:
        voice_client = await voice_channel.connect()
    except:
        pass
    ctx.guild.voice_client.play(discord.FFmpegPCMAudio('tts.mp3'))
Esempio n. 5
0
def say(stringToRead):
    tts = gtts(text=repr(stringToRead), lang="en")
    tts.save("tts.mp3")
    mixer.music.load("tts.mp3")
    mixer.music.play()
Esempio n. 6
0
# takes command line argument for file name
card_file = sys.argv[1]
# takes command line argument for the directory name where the mp3 files will
# be stored, and makes the directory if it does not exist already
directory = sys.argv[2]
if not os.path.exists(directory):
    os.makedirs(directory)
# prints file name to command line
print "The subject of these flashcards are: ", card_file
# opens file with name defined on the command line
f = open(card_file)
# counts the number of lines in the file
num_lines = sum(1 for num_lines in open(card_file))

# opens an empty list, then fills it with each line in the text file
my_list = list(f)
length = len(my_list)

# prints the number of 'flashcards' tp the command line
q_num = num_lines / 3
print "my_list is", length, " and the number of questions is: ", q_num

# closes the file
f.close()

for b in range(q_num):
    text = str(my_list[3 * b + 1] + my_list[3 * b + 2])
    name = str(my_list[3 * b]) + '.mp3'
    soundbite = gtts(text, lang='en')
    soundbite.save(directory + "/" + name)
Esempio n. 7
0
# takes command line argument for file name
card_file = sys.argv[1]
# takes command line argument for the directory name where the mp3 files will
# be stored, and makes the directory if it does not exist already
directory = sys.argv[2]
if not os.path.exists(directory):
    os.makedirs(directory)
# prints file name to command line
print ("The subject of these flashcards are: ",card_file)
# opens file with name defined on the command line
f = open(card_file)
# counts the number of lines in the file
num_lines = sum(1 for num_lines in open(card_file))

# opens an empty list, then fills it with each line in the text file
my_list = list(f)
length = len(my_list)

# prints the number of 'flashcards' tp the command line
q_num = num_lines/3
print ("my_list is",length," and the number of questions is: ",q_num)

# closes the file
f.close()

for b in range(q_num):
    text = str(my_list[3*b + 1]+my_list[3*b + 2])
    name = str(my_list[3*b])+'.mp3'
    soundbite = gtts(text, lang='tr')
    soundbite.save(directory+"/"+name)
Esempio n. 8
0
def playText(text):
    speech = gtts(text)
    speech.save("buffer.mp3")
    playsound("buffer.mp3")
    return 1
Esempio n. 9
0
from gtts import gtts

tts = gtts('hello')
print(tts)
# tts.save('C:\Users\taaviv\PointerAppAlyn\YOLOv3-Object-Detection-with-OpenCV\hello.mp3')
Esempio n. 10
0
def transform(text, f='record.mp3', slow=False):
    assert isinstance(text, str)
    
    record = gtts(text=text, lang='en', slow=slow)
    record.save(f)
    return f
Esempio n. 11
0
 async def _say(self, ctx, text, lang = 'en'):
     message = gtts(text, lang = lang)
     message.save('cache/tts/tts.mp3')
     ctx.guild.voice_client.play(discord.FFmpegPCMAudio('cache/tts/tts.mp3'))
Esempio n. 12
0
def speech(text):
    myaud = gtts(text=text, lang='en-uk', slow=False)
    name = random.randint(1, 10000000)
    myaud.save(str(name) + ".mp3")
    playsound.playsound(str(name) + ".mp3")
Esempio n. 13
0
def audio_br(words, mp3name, language="pt"):
    teste = gtts(text=words, lang=language)
    teste.save("%s.mp3")
def tomp3(message, name, language="pt"):
    print(message)
    print(name)
    convert = gtts(text=message, lang=language)
    convert.save("%s.mp3" % os.path.join("./files", name))