Hello, great work, do you have an idea how I can implement this feature: Instead of saying: "Jarvis" and waiting for the wake word to get detected then saying the command, you simply say "Jarvis what time is it" and it answers. Thanks
I don't believe you can take the audio received from Pvporcupine and send it straight to the Speech Recognition function. A very basic way would be to not have a wake word, but use a local running engine for the Speech to Text. . Then everything you say doesn't get stored in a google server, and your not constantly using the internet. Then just nest some loops in the code. if "Jarvis" in text_heard: if "what time is it" in text_heard: Give time code here elif "what day is it" in text_heard: Give date code here
@S-Tech so I contacted them and they said the model used doesn't listen to what I say afterward, would you happen to know one that does? The issue with the speech_recognition library is that its not accurate and misunderstands the wake word
Look into a library called “vosk”. It’s on device speech recognition. I stopped using the speech recognition library months ago and use that now. The only downside is that to get really accurate results you need to use the larger model and that loads about 6 Gbs into the memory when active. So if you have a small system (8 Gbs of RAM) it doesn’t work. If you saw the video where i disassembled the mini pc, that’s why I added more RAM. It picks up the word Jarvis pretty well.
Yeah. I use PyGame to make a animation for him talking. I have a semi recent demo of what he looks like here: th-cam.com/video/yAKlr1ZtAng/w-d-xo.html And a tutorial of how I made it here: th-cam.com/video/xNksGWKJ1fI/w-d-xo.html
Hi, just wanted to ask if you know why I would be getting an error that says " invalid sample rate " inside the audio_stream function my rate = porcupine.sample_rate so im not sure what is the issue
That function has to do with opening a stream with PyAudio. Are you using a windows machine? If so, it's possible PyAudio might not be installed correctly. There's been an issue with pip installing PyAudio in windows for awhile. I think I covered it in the first Jarvis DIY video.
@@S-Technology Have you ever encountered an issue that says "AssertionError: Audio source must be entered before listening, see documentation for AudioSource; are you using source outside of a with statement?" when running you code? At the moment, my wake word works fine but when it enters the takeCommand() function, it will give the said error
@@TheScorch78 In the takeCommand() function do you have your microphone as a source (Example: with sr.Microphone() as source: ) With a pi I believe you may need to make sure the microphone you are using is set as the default audio input device. You can also dedent the try & except below the with loop. (Like shown in answer here: stackoverflow.com/questions/65769263/assertionerror-audio-source-must-be-entered-before-listening) Both ways work on Windows, not sure about Rasbian.
@@S-Technology yes, I have made my microphone input the default on /home/pi/ .asoundrc, and I have tried dedenting the try & except loop, but it doesnt seem to work on the pi :(
hi I have 2 problems. The first is on the last line of code it says there is something wrong with putting "main()" and my second problem is it says "create() missing 1 required positional argument: access_key" for the porcupine = pvporcupine.create(keywords=["jarvis"]). What am I doing wrong?
Are you using the version of pvporcupine in the video? The newer versions require an account and you use the access key they supply you. You can do things like make your own hot words that way, but I don’t think they offer a free version with that. The older version is limited but free. And the main() function is named the same? Is one Main() or some other typo?
@@S-Technology i cant tell if I’m using your or not haha but I went to their python page and turns out I was reading the old version. Should i make an account they say that it’s free? Also for the main problem yes it’s the same main as the one I typed first but it’s still showing error
Thanks for the video, I ve got a list of errors that pop up when implementing the code: -Cannot connect to server socket err = No such file or directory -cannot connect to server request channel -jack server is not running or cannot be started -jackShmReadWritePtr: :~JackShmReadWritePtr - Init not done for -1, skipping unlock Can you help with this please
Are you using Ubuntu? I’m not to familiar with that. For some reason you are trying to create a socket for a server connection and it’s failing. I think the “jack server” is some kind of sound device. Maybe look at this link: askubuntu.com/questions/557906/problem-starting-jack-server-jack-server-is-not-running-or-cannot-be-started
I believe you can with the newer version of picovoice. I think you can create your own or access ones others have created. You have to use their online service for it and use an API key to access their databases. I wanted something that was completely offline, so the options are limited.
Thank you for this tutorial, and thank you for no GitHub...seriously! It's helping me learn python more. On that note, i've hit a big snag and I can't seem to figure it out. I am seemingly getting this error "||PaMacCore (AUHAL)|| Error on line 2499: err='-50', msg=Unknown Error" before the "Hotword detected..." prints out. It only throws the error when I say the hotword. Research implies there is something off with the audio driver, but I'm not sure. I should note I am using a Mac. Anyway, any help would be appreciated...this is a real exciting project.
Thank you. Hmm. What are you using for the audio driver? Are you using Pyaudio or something else? I would also try a different wake word to see if it gives the same results.
@@S-Technology I’m using pyaudio. Even made sure Portaudio was installed first then pyaudio. Reinstalled both several times. All my research has led to it being a driver issue, but I’m on a mac that is current on its updates. Latest pyaudio, portaudio, python, etc. i am using the lates pvporcupine too, but have my api key set. That part seems to be working. I really think it’s pyaudio somehow but im not sure. I may try it on another computer.
@@randallbenson6435 There was a random bug that would happen with pyaudio on windows where it wouldn't always install correctly. You would need to install additional binaries that are specific to your python version and windows OS specs. Maybe it's something similar. I did find something about an issue installing Pyaudio on M1 macs. I'm sure you probably already saw it. But if not, maybe it's helpful. discussions.apple.com/thread/252638887
@@S-Technology No, he wants to clone it. You know - that popular thing where you download code that's supposed to be free anyway. I'm confused - you want people to learn Python? Or you want to show people that you know Python? Or you simply want people to rewrite all that code and then share it anyway?
I’m aware of using git to clone projects. I don’t have a repository for this project. Python is free of course. But I’m not going to sit and hold people’s hands and do their homework for them. If you are just handed something you don’t learn it. Why such an attitude?
def wake_word() -> int: """ Processes a single audio frame and returns the keyword index if detected, otherwise -1. Args: stream: Audio stream. porcupine: Porcupine instance. Returns: Keyword index if detected, otherwise -1. """ porcupine = pvporcupine.create(keywords=['jarvis']) pa = pyaudio.PyAudio() # Open an audio stream for the wake word detector wake_word_stream = pa.open(rate=porcupine.sample_rate, channels=1, format=pyaudio.paInt16, input=True, frames_per_buffer=porcupine.frame_length) # Read a single audio frame from the stream pcm = wake_word_stream.read(porcupine.frame_length) # Convert the PCM data to a list of samples pcm = struct.unpack_from("h" * porcupine.frame_length, pcm) # Process the audio frame and return the keyword index return porcupine.process(pcm) def init_jarvis() -> None: """ Initializes the Jarvis voice assistant and runs the main loop. Returns: None. """ try: # Create a Porcupine instance with the Jarvis keyword # Main loop while True: # Listen for the wake word keyword_index = wake_word() I am trying to encapsulate the logic, inside the function and have the wake_word() inside the main while loop, however the word is not detected.
Its awesome! My voice assistent has gotten better, thanks to you!
Thank you so much! This helped me a lot! I've been searching the internet for 6 months and this saved me!
You deserve a ton of subscribers bro.
Thank you. 😄
thank you, your tutorials are very helpful i also enjoy your content!
Thank You! I’m glad you found them helpful.
Bro you need deserve more subs
Thank you. Just trying my best.
Thank you sirrr
I was looking for aa wake up word program you are greattt
Thank you. I hope it helps.
Hello, great work, do you have an idea how I can implement this feature:
Instead of saying: "Jarvis" and waiting for the wake word to get detected then saying the command, you simply say "Jarvis what time is it" and it answers.
Thanks
I don't believe you can take the audio received from Pvporcupine and send it straight to the Speech Recognition function.
A very basic way would be to not have a wake word, but use a local running engine for the Speech to Text. . Then everything you say doesn't get stored in a google server, and your not constantly using the internet.
Then just nest some loops in the code.
if "Jarvis" in text_heard:
if "what time is it" in text_heard:
Give time code here
elif "what day is it" in text_heard:
Give date code here
@S-Tech yeah, kinda disappointed as I want to use pvporcupine for its accuracy, ill try and contact them to look for a solution, thanks
@S-Tech so I contacted them and they said the model used doesn't listen to what I say afterward, would you happen to know one that does? The issue with the speech_recognition library is that its not accurate and misunderstands the wake word
Look into a library called “vosk”. It’s on device speech recognition. I stopped using the speech recognition library months ago and use that now.
The only downside is that to get really accurate results you need to use the larger model and that loads about 6 Gbs into the memory when active. So if you have a small system (8 Gbs of RAM) it doesn’t work. If you saw the video where i disassembled the mini pc, that’s why I added more RAM.
It picks up the word Jarvis pretty well.
@@S-Technology got it, thanks for the help
can you make him appear on your screen as a image or as a gif? (not thorough Google tho)
Yeah. I use PyGame to make a animation for him talking.
I have a semi recent demo of what he looks like here: th-cam.com/video/yAKlr1ZtAng/w-d-xo.html
And a tutorial of how I made it here: th-cam.com/video/xNksGWKJ1fI/w-d-xo.html
Can i please have the source code for this video please (if possible)
Hi, just wanted to ask if you know why I would be getting an error that says " invalid sample rate " inside the audio_stream function
my rate = porcupine.sample_rate so im not sure what is the issue
That function has to do with opening a stream with PyAudio. Are you using a windows machine? If so, it's possible PyAudio might not be installed correctly. There's been an issue with pip installing PyAudio in windows for awhile. I think I covered it in the first Jarvis DIY video.
@@S-Technology I'm actually using a raspberry pi
@@S-Technology Have you ever encountered an issue that says "AssertionError: Audio source must be entered before listening, see documentation for AudioSource; are you using source outside of a with statement?" when running you code? At the moment, my wake word works fine but when it enters the takeCommand() function, it will give the said error
@@TheScorch78 In the takeCommand() function do you have your microphone as a source (Example: with sr.Microphone() as source: )
With a pi I believe you may need to make sure the microphone you are using is set as the default audio input device. You can also dedent the try & except below the with loop. (Like shown in answer here: stackoverflow.com/questions/65769263/assertionerror-audio-source-must-be-entered-before-listening)
Both ways work on Windows, not sure about Rasbian.
@@S-Technology yes, I have made my microphone input the default on /home/pi/ .asoundrc, and I have tried dedenting the try & except loop, but it doesnt seem to work on the pi :(
hi I have 2 problems. The first is on the last line of code it says there is something wrong with putting "main()" and my second problem is it says "create() missing 1 required positional argument: access_key" for the porcupine = pvporcupine.create(keywords=["jarvis"]). What am I doing wrong?
Are you using the version of pvporcupine in the video? The newer versions require an account and you use the access key they supply you. You can do things like make your own hot words that way, but I don’t think they offer a free version with that.
The older version is limited but free.
And the main() function is named the same? Is one Main() or some other typo?
@@S-Technology i cant tell if I’m using your or not haha but I went to their python page and turns out I was reading the old version. Should i make an account they say that it’s free? Also for the main problem yes it’s the same main as the one I typed first but it’s still showing error
how do i use the older version?@@S-Technology
Thanks for the video, I ve got a list of errors that pop up when implementing the code:
-Cannot connect to server socket err = No such file or directory
-cannot connect to server request channel
-jack server is not running or cannot be started
-jackShmReadWritePtr: :~JackShmReadWritePtr - Init not done for -1, skipping unlock
Can you help with this please
Are you using Ubuntu? I’m not to familiar with that.
For some reason you are trying to create a socket for a server connection and it’s failing. I think the “jack server” is some kind of sound device. Maybe look at this link: askubuntu.com/questions/557906/problem-starting-jack-server-jack-server-is-not-running-or-cannot-be-started
Is there a way i can add a custom word? A tutorial on that would be so great.
I believe you can with the newer version of picovoice. I think you can create your own or access ones others have created. You have to use their online service for it and use an API key to access their databases. I wanted something that was completely offline, so the options are limited.
Thank you for this tutorial, and thank you for no GitHub...seriously! It's helping me learn python more. On that note, i've hit a big snag and I can't seem to figure it out. I am seemingly getting this error "||PaMacCore (AUHAL)|| Error on line 2499: err='-50', msg=Unknown Error" before the "Hotword detected..." prints out. It only throws the error when I say the hotword. Research implies there is something off with the audio driver, but I'm not sure. I should note I am using a Mac. Anyway, any help would be appreciated...this is a real exciting project.
Thank you.
Hmm. What are you using for the audio driver? Are you using Pyaudio or something else? I would also try a different wake word to see if it gives the same results.
@@S-Technology I’m using pyaudio. Even made sure Portaudio was installed first then pyaudio. Reinstalled both several times. All my research has led to it being a driver issue, but I’m on a mac that is current on its updates. Latest pyaudio, portaudio, python, etc. i am using the lates pvporcupine too, but have my api key set. That part seems to be working. I really think it’s pyaudio somehow but im not sure. I may try it on another computer.
@@randallbenson6435 There was a random bug that would happen with pyaudio on windows where it wouldn't always install correctly. You would need to install additional binaries that are specific to your python version and windows OS specs. Maybe it's something similar.
I did find something about an issue installing Pyaudio on M1 macs. I'm sure you probably already saw it. But if not, maybe it's helpful. discussions.apple.com/thread/252638887
is it
a open sourse prjoect? Can i get link on github?
I didn’t make a GitHub for it. Sorry
Thank you bro. You Are The Man.
thank's bro really great work : )
Thank you. I hope it was useful.
i dont know if i make something wrong, but its not working
Is it giving an error code of some kind? What’s not working?
@@S-Technology it was my bad, i forgot to put the "main()" in the end 🤡 sorry
@@S-Technology but, my winsound dont work, im searching to see if there is any solution, it just dont play any sound
edit: nevermind, find out
I've done that many times. It happens. haha
Glad you got it working.
could you give a source code please
The code is in the video. Are you wanting to just copy it? I’m confused.
@@S-Technology No, he wants to clone it. You know - that popular thing where you download code that's supposed to be free anyway.
I'm confused - you want people to learn Python? Or you want to show people that you know Python? Or you simply want people to rewrite all that code and then share it anyway?
I’m aware of using git to clone projects.
I don’t have a repository for this project.
Python is free of course. But I’m not going to sit and hold people’s hands and do their homework for them. If you are just handed something you don’t learn it.
Why such an attitude?
when i say jarvis he is still listening, can u help
def wake_word() -> int:
"""
Processes a single audio frame and returns the keyword index if detected, otherwise -1.
Args:
stream: Audio stream.
porcupine: Porcupine instance.
Returns:
Keyword index if detected, otherwise -1.
"""
porcupine = pvporcupine.create(keywords=['jarvis'])
pa = pyaudio.PyAudio()
# Open an audio stream for the wake word detector
wake_word_stream = pa.open(rate=porcupine.sample_rate,
channels=1,
format=pyaudio.paInt16,
input=True,
frames_per_buffer=porcupine.frame_length)
# Read a single audio frame from the stream
pcm = wake_word_stream.read(porcupine.frame_length)
# Convert the PCM data to a list of samples
pcm = struct.unpack_from("h" * porcupine.frame_length, pcm)
# Process the audio frame and return the keyword index
return porcupine.process(pcm)
def init_jarvis() -> None:
"""
Initializes the Jarvis voice assistant and runs the main loop.
Returns:
None.
"""
try:
# Create a Porcupine instance with the Jarvis keyword
# Main loop
while True:
# Listen for the wake word
keyword_index = wake_word()
I am trying to encapsulate the logic, inside the function and have the wake_word() inside the main while loop, however the word is not detected.