Python Voice Assistant Tutorial #1 – Playing Sound with gTTS (Google Text to Speech)

///Python Voice Assistant Tutorial #1 – Playing Sound with gTTS (Google Text to Speech)

Python Voice Assistant Tutorial #1 – Playing Sound with gTTS (Google Text to Speech)

FavoriteLoadingAdd to favorites

A full python voice assistant tutorial. In this series I will be showing how to create a python virtual/voice assistant using modules like gTTS (google text to speech) and SpeechRecognition. I will be adding features to the assistant that utilize web scraping and automation. If you have any ideas for what you’d like the assistant to do leave them down below.

Playlist:

Text-Based Tutorial:
Download PyAudio:

Required Moudles:
– PyAudio
– gTTS
– SpeechRecognition
– playsound

◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python

📸 Instagram:
🌎 Website
📱 Twitter:
⭐ Discord:
📝 LinkedIn:
📂 GitHub:
🔊 Podcast:

💵 One-Time Donations:
💰 Patreon:
◾◾◾◾◾◾

⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡

Tags:
– Tech With Tim
– Python Tutorials
– Python Voice Assistant
– Voice Assistant Tutorial Python
– Python JARVIS Tutorial
– Voice Assistant Python

#python #VoiceAssistant #gTTS

source

By |2021-02-04T12:16:42+00:00February 4th, 2021|Python Video Tutorials|39 Comments

39 Comments

  1. Jude Riley February 4, 2021 at 12:16 pm - Reply

    guys i need help!! i cant pip install pyaudio it just gives me lots of errors :((

  2. Hossein Zakariaee February 4, 2021 at 12:16 pm - Reply

    very good like always

  3. Jackson Sophat February 4, 2021 at 12:16 pm - Reply

    This is awesome. Thank you for sharing this content.

  4. Safaa Daoud February 4, 2021 at 12:16 pm - Reply

    OMG! It works
    Thaaaaanks, I will subscribe!

  5. Safaa Daoud February 4, 2021 at 12:16 pm - Reply

    for what stands german in lang in gTTS is it de?

  6. Safaa Daoud February 4, 2021 at 12:16 pm - Reply

    i have windows 64

  7. ninjaknifer14 February 4, 2021 at 12:16 pm - Reply

    I cannot get playsound to work anybody else have this issue or a solution? I installed it but it isnt letting me import it to the code

  8. Shashank Mishra February 4, 2021 at 12:16 pm - Reply

    Please help me.
    In my Ubuntu os when I run this script voice. mp3 is saved but no voice coming from the speaker. Even voice.mp3 file work properly when I open it explicitly.

  9. Umesh Lab February 4, 2021 at 12:16 pm - Reply

    THERE IS A GOOD THING TO DONE WHEN PYAUDIO ISN'T WORKING.
    OPEN CMD AS ADMINSTRATOR THEN WRITE THIS TWO COMMAND.
    1. pip install pipwin
    2. pipwin install pyaudio . this worked

  10. Wesley Martel February 4, 2021 at 12:16 pm - Reply

    I cant hear it
    import os

    import time

    import playsound

    import speech_recognition as sr

    from gtts import gTTS

    def speak(text):

    tts = gTTS(text=text, lang='en')

    filename = "voice.mp3"

    tts.save(filename)

    playsound.playsound(filename)

    speak("527 Lidham Place")

    this is right though, right??

  11. The Dude February 4, 2021 at 12:16 pm - Reply

    hey guys if you want to install pyaudio on other than windows that create a new project in python and add an interperter that has anaconda and then go to terminal and go ahead and type 'pip install pyaudio'. Make sure you have pip installed. Then exit pycharm and remove you're project from pycharm but dont delete it. then drag it to sublime text or any other editor and boom! you have pyaudio

  12. Leul Eshetu February 4, 2021 at 12:16 pm - Reply

    Thanks Tim!

  13. Zrobilive February 4, 2021 at 12:16 pm - Reply

    pls help the speak function doesnt work

  14. Saksham Singh February 4, 2021 at 12:16 pm - Reply

    OMG this is soo natural voice !!!

  15. RATAN AGARWAL February 4, 2021 at 12:16 pm - Reply

    work your prog with python 3.8.6

  16. RATAN AGARWAL February 4, 2021 at 12:16 pm - Reply

    https://youtu.be/4cXn3BaWsP8 pl run share and subs if u like

  17. Rajeswari Baby February 4, 2021 at 12:16 pm - Reply

    Hey I love yoir videos on voice assistant in python and I have watched all yoir videos but I ask you to add a feature like google assistant. Please add a button called click to speak… which when click will activate voice recognotion and when clicked again it should turn the recognition off. This idea will be great please do it

  18. Suprito Ghosh February 4, 2021 at 12:16 pm - Reply

    hey best version to install pyaudio is
    first type : pip install pipwin
    then hit enter
    type : pipwin install pyaudio

  19. 5kyw41k3r February 4, 2021 at 12:16 pm - Reply

    Your the best youtuber that help's me to code, you don't beg for subs at the start of the video and get down to business. Your content is great. Something about the vids that you upload makes me learn the subject. Bless you!

  20. Nivya Dileep February 4, 2021 at 12:16 pm - Reply

    thankyou sir

  21. Riddu Sarav February 4, 2021 at 12:16 pm - Reply

    how do you add web scraping to this?

  22. Tarun Khare February 4, 2021 at 12:16 pm - Reply

    For mac user's if you are getting error install pyaudio use following steps.

    brew install portaudio
    sudo pip3 install –global-option='build_ext' –global-option='-I/usr/local/include' –global-option='-L/usr/local/lib' pyaudio

  23. Saketh p February 4, 2021 at 12:16 pm - Reply

    Thanka a lot but i misheard a sentence and by mistake made a water wall to defeat fire wall in every way also with machine learning

  24. Vivek Raj February 4, 2021 at 12:16 pm - Reply

    I am trying hard but I am not able to install pyaudio.
    Does anyone like to help me ?

  25. Ashwin Krishnan February 4, 2021 at 12:16 pm - Reply

    Hey Tim,

    While executing the same, the audio output is missing some words initially (first two words many times) and pronouncing only the last few letters or words.

    For more information, I am using pycharm ide to run the program and using default windows player.

    could u kindly let me know why is this happening? And also how to resolve this?

  26. Yuvraj Singh hbtpJGSKgd February 4, 2021 at 12:16 pm - Reply

    ValueError: Unable to find token seed! Did https://translate.google.com change? getting this error what should i do?

  27. Aindrila Das February 4, 2021 at 12:16 pm - Reply

    If anyone is having trouble installing pyaudio in macbook run these commands on your terminal:
    brew install portaudio
    pip install pyaudio

  28. Aindrila Das February 4, 2021 at 12:16 pm - Reply

    While running on macbook I'm getting this error:
    ModuleNotFoundError: No module named 'playsound'
    Though I have installed playsound

  29. hajar oubrahim February 4, 2021 at 12:16 pm - Reply

    if you have a erorr in windows go to this link https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio and shersh pyaudio and go to power shell and python -m pip install Pyaudio and then click tab but you must to be in der of the file you install from the link and then this is will be installing

  30. TheHiddenCode February 4, 2021 at 12:16 pm - Reply

    What's the IDE?

  31. Rkya Cndy February 4, 2021 at 12:16 pm - Reply

    Thanks that was cool! But can I change the default voice? Mine sounds like google translate

  32. Rizwan Rahim February 4, 2021 at 12:16 pm - Reply

    man i owe u some

  33. Ice Flame February 4, 2021 at 12:16 pm - Reply

    I cannot download those pip files.

  34. spikeinellect07 February 4, 2021 at 12:16 pm - Reply

    in my program lang command is not working

  35. spikeinellect07 February 4, 2021 at 12:16 pm - Reply

    which python ide software do you use

  36. מדריכי מחשבים February 4, 2021 at 12:16 pm - Reply

    Hi,
    This video is great but when I am running the program I need to wait some seconds until it says something.
    Thanks.

  37. Prof Sameer February 4, 2021 at 12:16 pm - Reply

    Language not recognize help please

  38. Russian Boy February 4, 2021 at 12:16 pm - Reply

    when i trying to download the pyaudio its says:

    Running setup.py install for pyaudio … error

    ERROR: Command errored out with exit status 1:

    command: 'c:usersuserappdatalocalprogramspythonpython38-32python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\user\AppData\Local\Temp\pip-install-ty2tz2el\pyaudio\setup.py'"'"'; __file__='"'"'C:\Users\user\AppData\Local\Temp\pip-install-ty2tz2el\pyaudio\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install –record 'C:UsersuserAppDataLocalTemppip-record-zho8j1s4install-record.txt' –single-version-externally-managed –compile –install-headers 'c:usersuserappdatalocalprogramspythonpython38-32Includepyaudio'

    cwd: C:UsersuserAppDataLocalTemppip-install-ty2tz2elpyaudio

    Complete output (9 lines):

    running install

    running build

    running build_py

    creating build

    creating buildlib.win32-3.8

    copying srcpyaudio.py -> buildlib.win32-3.8

    running build_ext

    building '_portaudio' extension

    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/

    —————————————-

    ERROR: Command errored out with exit status 1: 'c:usersuserappdatalocalprogramspythonpython38-32python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\user\AppData\Local\Temp\pip-install-ty2tz2el\pyaudio\setup.py'"'"'; __file__='"'"'C:\Users\user\AppData\Local\Temp\pip-install-ty2tz2el\pyaudio\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install –record 'C:UsersuserAppDataLocalTemppip-record-zho8j1s4install-record.txt' –single-version-externally-managed –compile –install-headers 'c:usersuserappdatalocalprogramspythonpython38-32Includepyaudio' Check the logs for full command output.

    what to do?

  39. Tristan Lundy February 4, 2021 at 12:16 pm - Reply

    Can anyone help? I am getting a lot of errors like "text" is not defined and expected an indent block but I copied exactly what he did. Please help

Leave A Comment

*