When I first got into coding, I dreamed about creating my own local version of Siri for my desktop; lying back on my chair and doing things with just my voice was what I always wanted. After coding with Java for over a year, I decided that it was time to learn more than just using JFrame and creating classes.
"Zero" is a speech recognition bot I coded using the Sphinx4 voice recognition library in Java and the Selenium Webdriver for Chrome. Although no Siri by any means, the bot can open and close windows, create tabs, open sites etc. using just my voice. The demo for the bot and its commands as of now can be found below:
1) Setting up the voice recognition:
Luckily, there is already documentation on how to get started with sphinx4. The Jar Files for this library can be downloaded here.
As you can see, each recognizer should have an Acoustic Model Path, a Dictionary Path and a Language Model Path set. After running the code, I figured out that the recognizer was actually wrong a lot of the times when trying to detect what I was saying. As a result, I decided to use a Grammar file instead
Creating a Grammar file was better in my case, because I wanted my bot to detect certain phrases or commands.
2) Setting up Selenium Webdriver for Chrome:
I downloaded the Selenium Webdriver I needed for Java from here. Don't forget to add the Jar Files to the project library after downloading.
Since Selenium supports only Firefox, I also had to download ChromeDriver 2.3.1. You are going to have to setup the Chrome Driver by typing in the following:
System.setProperty("webdriver.chrome.driver", Location of the Driver);
driver = new ChromeDriver();
Once this was done, Selenium was ready to go! You can find a lot of Selenium Commands online to help you with opening websites, windows etc.



This comment has been removed by the author.
ReplyDeletewhat is the minimum hardware requirement ..it needs
Deleteany laptop with a working mic should work. if you need the code you can find it on my github here: https://github.com/yashhshah/VoiceBot
Deleteif you go to src you can find the code there.
thank you bro its working great ..but will it be able to recognize any English word apart from the commands in grammar file..
DeleteTechnically yes. But in practice i found the library was not that ideal for recognizing words normally. If anything you can look at the documentation and try it out for yourself, dont forget to set the dictionary path to do so!
Deletethank you very much for replying :) i tried it it's not at all accurate without setting dictionary path ... i am doing my final year project ,your code helped me a lot in understanding sphinx usage ...can i get your mail address to be in touch with you
ReplyDeleteThis comment has been removed by the author.
Delete