Python Voice Assistant Tutorial #9 - Waking the Assistant
Skills:
LLM Foundations80%Multimodal LLMs60%Prompting Basics50%Agent Foundations50%Tool Use & Function Calling50%
Key Takeaways
This video tutorial demonstrates how to create a wake keyword for a Python voice assistant, allowing users to trigger the assistant with a specific word or phrase, such as 'hey tim', using tools like Python and get_audio.
Full Transcript
hello everyone and welcome back to their Python voice assistant tutorials what I'm gonna be doing in this video is fixing a few bugs that have occurred from previous videos as well as adding a wake word to our assistant now this might be split into two parts depending on how long this takes me but what we're gonna be doing is making it so that we can say something like hey Tim or hey Google or hey botch or whatever we want and that will trigger the voice assistant to actually start listening for the command so we'll always be listening but it will only be listening for commands after we have that wake word which is what you guys were suggesting to me now before we move too far let's fix a few bugs so the first thing that I want to do is just go up and get audio here and this is what you guys have recommended and I don't know why I didn't do this to start when we returned said here I'm just gonna return said lower because that's gonna make it so we don't have to keep calling dealt lower every time we want to get the the value of text because we don't really care about the Capitals at all so what I'm gonna do now is just get rid of wherever I put down lower so like get audio down lower it don't don't need that get audio dot lower pretty much anywhere we have dot lower we don't need that anymore because we've just fixed that and saved us a bit of time now the next thing I'm gonna do is go into this get events function and change a bug that actually our friend here Doug pointed out to me in one of the comments section some of you guys have points them out as well but this one seems significant to me so that's why I'm kind of sharing him out here he was saying essentially that if our event falls in the afternoon the way that I've programmed get events is it will actually cut off the like the half an hour point if it starts at that time so if it doesn't fall directly on the hour and it starts at you know 12:30 or 1:30 or something like that it won't say the 30 aspect so we need to include that so to do that we're just gonna take this line here so plus start underscore time dot split at : 1 and add that to the end right here so inside this for loop inside this else and this first line here I'm gonna add that line so + start time dot split : at 1 now the reason this is happening is because I was just taking the hour aspect I wasn't taking the minute aspect which I need so this will add the minute aspect to that and that should be good for us now at least I've tested this and it did work so I'm hoping that this will be fine the way that we have it now ok so now that we've done that let's just do a quick test here and see if this is actually working so I'm just gonna run this what do I have on Wednesday at 1:00 p.m. to toriel 2:30 p.m. okay so there we got that now 2:30 p.m. so that is working and we are all good to go all right so now that we've done that what I'm gonna do is include this wake keyword so I'm gonna start by just creating a variable here at the bottom called Wake word or like awake I shall just say one my sect not way not week Wake equals they're going to put the string that we want to wake up with here in lowercase in this case I'm just gonna make mine hate Tim so if you say hey Tim then we'll be good to go and we will wake up so what are we gonna do now to get this working well we need to essentially put all of this inside of a while loop and start doing kind of it's slightly complex but we just need to always be listening see if we ever say hey Tim and if we do alert the user and then start looking through their next command for any of this so like write something down or asking about the events that we have so what I'm gonna do is I'm just going to make a while loop here let's say a while true like that and I'll take all this and indent that now what I'm gonna do is keep text equals get underscore audio but I'm gonna just do an if statement here and say if text dot count wake greater than one then what we'll do is we'll do all of this now I'm else we're just gonna say speak I am ready and then what I'm gonna do is say text equals get underscore audio one more time now let me explain how this is gonna work so what we're gonna do is we're gonna be constantly listening so always listening in this while loop now as soon as this picks up some kind of text so this get audio function which is all the way up here it will return that to text and then what we're gonna do is check if we said hey Tim now if we said hey Tim anywhere in that kind of blob of text that we got there what we'll do is we'll say tell the assistant to say I am ready after it says I'm ready it will wait for another command cuz so think about it like this right like we're talking maybe having having a conversation and all of a sudden I say hey Tim we wait a second and then it says I am ready okay and then you say what do I have on Wednesday and then it takes this text and it will process any command based off of that now I'm just gonna make one slight change here in this speak function so it's a speak please try again inside of for phrase what I'm gonna do is just change this to I didn't or I don't understand rather than try again because saying try again will prompt the user to want to just say the command again rather than start with hate Tim which is not exactly what we want so anyways I think this should be okay for now to start testing with there might be a few things I need to change after this let me just look on my other screen to make sure I didn't make an error okay what I'm actually gonna do is just add another text another print statement in here just says listening so that we know every time that this runs and we get an idea of kind of how this is working so what I'm gonna do is bring this up here and run this and then see if this is working for us okay so it started we're listening you can hear that I'm talking here and nothing's happening with the with the voice so I'm just gonna turn my volume up so you guys can hear okay so I just ran this and realized I've made a critical error here instead of saying greater than one I need to say greater than zero otherwise that's like never gonna work unless you say hey Tim twice I'm sure you guys probably caught that but anyway so let's just change that let's run it again you can see this is what happened last time okay so I need to run this okay so we're just talking here pretend we're having conversation all of a sudden I say hey Tim I am ready okay it says I'm ready what do I have on Tuesday um who invents on this day si si si 21 10:10 a.m. si si si 21 10 11 1:00 p.m. 21:05 11 5:30 a.m. atm 15:40 lectures at 7:00 p.m. and there we go and now it's listening again and wait ready hey Tim I already make a note what we wouldn't like me to write down remember this I might even go to net and there we go and now I can continue talking like I normally would as if we're doing the tutorial here and at any point if I say hey Tim I already make a note what would you like me to write down Tim I might even go hit that and there we go now I guess it didn't actually get what I said there but anyways you guys can see kind of how this works so it's always listening it waits for that wake word and yes it does take a second to detect the hey Tim I don't really know a way around doing that and changing that I'm gonna look at that and see if I can maybe fix that in the next video and give like some tweaks to how all this works but I think that's pretty good it's working pretty well now and I mean you get the idea right we're always listening waits for the wake word if you do it long enough pause between the wake word then it will say okay I'm ready or say whatever we have here it'll get the audio again and then it will actually do all of the commands so that is kind of how this works again all this code will be available in the text-based tutorial whenever that does come out of that being said as always if you have more ideas for the series leave a comment down below and I'll make sure to try to include that in future videos so with that being said if you guys enjoyed please leave a like and subscribe to the channel I will see you guys in more videos
Original Description
In this python voice assistant tutorial I will cover how we can create a wake keyword for our assistant. This word will allow us to trigger the assistant. Something like "hey tim".
Text-Based Tutorial: https://techwithtim.net/tutorials/voice-assistant/wake-keyword/
Playlist: https://www.youtube.com/watch?v=-AzGZ_CHzJk&list=PLzMcBGfZo4-mBungzp4GO4fswxO8wTEFx
◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python
https://tech-with-tim.teachable.com/p...
📸 Instagram: https://www.instagram.com/tech_with_tim
🌎 Website https://techwithtim.net
📱 Twitter: https://twitter.com/TechWithTimm
⭐ Discord: https://discord.gg/pr2k55t
📝 LinkedIn: https://www.linkedin.com/in/tim-rusci...
📂 GitHub: https://github.com/techwithtim
🔊 Podcast: https://anchor.fm/tech-with-tim
💵 One-Time Donations: https://www.paypal.com/donate/?token=...
💰 Patreon: https://www.patreon.com/techwithtim
◾◾◾◾◾◾
⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡
Tags:
- Tech With Tim
- Python Tutorials
- Python voice assistant tutorial
- Python voice assistant
- Voice Assistant Python
#Python
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Tech With Tim · Tech With Tim · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
A* Path Finding Algorithm(Visualization)
Tech With Tim
Python Programming Tutorial #1 - Variables and Data Types
Tech With Tim
Python Programming Tutorial #2 - Basic Operators and Input
Tech With Tim
Python Programming Tutorial #3 - Conditions
Tech With Tim
Python Programming Tutorial #4 - IF/ELIF/ELSE
Tech With Tim
Python Programming Tutorial #5 - Chained Conditionals and Nested Statements
Tech With Tim
Python Programming Tutorial #6 - For Loops
Tech With Tim
Python Programming Tutorial #7 - While Loops
Tech With Tim
Python Programming Tutorial #8 - Lists and Tuples
Tech With Tim
Python Programming Tutorial #9 - Iteration by Item (For Loops Continued...)
Tech With Tim
Python Programming Tutorial #10 - String Methods
Tech With Tim
How to Overclock a NVIDIA GPU
Tech With Tim
Python Programming Tutorial #11 - Slice Operator
Tech With Tim
Python Programming Tutorial #12 - Functions
Tech With Tim
Python Programming Tutorial #13 - How to Read a Text File
Tech With Tim
Python Programming Tutorial #14 - Writing to a Text File
Tech With Tim
Python Programming Tutorial #15 - Using .count() and .find()
Tech With Tim
Python Programming Tutorial #16 - Introduction to Modular Programming
Tech With Tim
Python Programming Tutorial #17 - Optional Parameters
Tech With Tim
Python Programming Tutorial #18 - Try and Except (Python Error Handling)
Tech With Tim
Python Programming Tutorial #19 - Global vs Local Variables
Tech With Tim
Python Programming Tutorial #20 - Classes and Objects
Tech With Tim
Cool VBS Script to Prank Your Friends!
Tech With Tim
How to Overclock an AMD GPU
Tech With Tim
Best GPU'S For Mining Ethereum (2018)
Tech With Tim
Recursion and Memoization Tutorial Python
Tech With Tim
Ethereum Mining Rig - Hardware Guide
Tech With Tim
Pygame Tutorial #1 - Basic Movement and Key Presses
Tech With Tim
How to Install Pygame (Windows 8/10)
Tech With Tim
How to Trade Your Cryptocurrency (Bitcoin, Ethereum etc.) For Cash!
Tech With Tim
How to Mine Ethereum 2018 - WORKING (Super-Easy)
Tech With Tim
Microphone Comparison - $10 Mic vs $150 Mic (Blue Yeti USB)
Tech With Tim
Pygame Tutorial #2 - Jumping and Boundaries
Tech With Tim
Pygame Tutorial #3 - Character Animation & Sprites
Tech With Tim
Pygame Tutorial #4 - Optimization & OOP
Tech With Tim
OBS Studio Tutorial - Best OBS Settings
Tech With Tim
Linear Search Algorithm - Python Example and Code
Tech With Tim
Make Any Mic Sound AMAZING! (WITH OBS)
Tech With Tim
Binary Search Algorithm - Python Example & Code
Tech With Tim
Pygame Tutorial #5 - Projectiles
Tech With Tim
Pygame Game - Mini Golf
Tech With Tim
Pygame Tutorial - Projectile Motion (Part 1)
Tech With Tim
Pygame Tutorial - Projectile Motion (Part 2)
Tech With Tim
Pygame Tutorial #6 - Enemies
Tech With Tim
Pygame Tutorial #7 - Collision and Hit Boxes
Tech With Tim
Pygame Tutorial #8 - Scoring and Health Bars
Tech With Tim
Cloud Mining vs. Hardware Mining - 2018
Tech With Tim
How to Install Pygame on Mac OSX (Fast-Simple)
Tech With Tim
Pygame Tutorial #9 - Sound Effects, Music & More Collision
Tech With Tim
Pygame Tutorial #10 - Finishing Touches & Next Steps
Tech With Tim
How to Fade Your Screen in Pygame [CODE IN DESCRIPTION]
Tech With Tim
How to Create a Button in Pygame [CODE IN DESCRIPTION]
Tech With Tim
Pygame Side-Scroller Tutorial #1 - Scrolling Background/Character Movement
Tech With Tim
Pygame Side-Scroller Tutorial #2 - Random Object Generation
Tech With Tim
Pygame Side-Scroller Tutorial #3 - Collision
Tech With Tim
Pygame Side-Scroller Tutorial #4 - Scoring and End Screen
Tech With Tim
How to Create A Message Box in Python - Tkinter
Tech With Tim
Is Ethereum Mining Still Profitable - Is It Worth It (April 2018)
Tech With Tim
How to Run MAC OSX on a WINDOWS PC (Clover Boot-loader)
Tech With Tim
Programming Problem #1 - Alphabet Soup (Beginner/Novice)
Tech With Tim
More on: LLM Foundations
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
I Asked ChatGPT to Fix My Life. It Couldn’t — Until I Changed One Thing
Medium · AI
I Asked ChatGPT to Fix My Life. It Couldn’t — Until I Changed One Thing
Medium · ChatGPT
Claude Sonnet 5 Is Here: Why It Might Replace Your Opus Subscription
Medium · Programming
Introducing Claude Sonnet 5 on AWS: Anthropic’s most capable Sonnet model
AWS Machine Learning
🎓
Tutor Explanation
DeepCamp AI