Coders Packet

Speech Recognition to search Google and YouTube using Python

By Deepak Kumar Jha

Basically, I make a program to detect speech and translate into text and then search Google or YouTube whatever we says. I have used Python language and also used speech_recognition library.

So, I first import all the necessary libraries like speech_recognition and webbrowser also to open my chrome browser. 

First of all, I have created a Recognizer instance using sr.recognizer() function and using this instance I have taken Microphone as my source for audio capturing. After capturing the audio, program uses recognize_google() function to convert into text the audio.

Now, programs search for either Google or YouTube in the converted text and further runs accordingly to provide search results. Below are the screenshot of my output.

Below you can see after runing the program, it asks what do we want to search google or youtube and then tell us to speak. If we say Google or anything that includes Google, it will show that "You Choose Google".

After that it asks for query we want to search on google and then shows what we say and opens the browser with the search results.




Now what if we choose YouTube instead of Google. Below you can see the output when we say youtube, it asks for the video that we want to search on YouTube and then immediately opens YouTube with the search results




So, this was all about my project. Thanks

Download Complete Code


No comments yet