Hello everyone, I am a beginner and new to letsmakerobots.com. I love the site. I have a project in school that involves designing a speech recognition system,and am in dire need of help. Suggestions and resources would be a life-saver. feel free to drop a message,or better still,email me at: [email protected]. Thank you all.
re: Speech Recognition
Max gives good advice. If you buy an android, you can do the speech recognition part in page or two of java code using Google’s speech services, and the solution will be small enough to fit into a small robot.
Good speech recognition now uses large deep learning algos and data that you can’t hope to match alone. Think of it as a mountain that you could never climb without a massive support team…and why bother?
Once you recognize the speech, you’ll need to do something with it. You’ll have to do something on your own here unless you want to use my Lucy brain project.
Also, you might want to have the robot speak back. This is easy on Android. Another couple pages of java tops.
What system and constraints do you have?
Speech recognition is a very large field.
-
How long do you have for this project?
-
Which OS are you using?
-
What hardware and software are you using?
-
What is the final deliverable?
The answers to these questions are important to the help we can give you.
I know little about the
I know little about the suggestion you have offered,but it sounds ‘doable’.Please could you care to share more light on the technique involved?.Thanks…itching to learn and hear from you all
Android Speech Recognition Code
Here are the key bits for doing speech recogition on Android using Google’s service. You can also find code by searching on google for something like “SpeechRecognizer Android Code”, “RecognitionListener Android code”.
You’ll need to create an activity that either has a button or is setup to respond to touch events, my sample uses a form where touching any part of the form starts speech recognition. That is what the OnTouchListener is doing.
The key code excerpts from the activity (form)…
public class YourActivityName extends Activity implements OnTouchListener
{
//Declare this variable in your activity
private SpeechRecognizer _SpeechRecognizer;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
_SpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(this);
_SpeechRecognizer.setRecognitionListener(new ListenSvc());
}
public boolean onTouch(View v, MotionEvent event)
{
SpeakButtonClick();
return true;
}
@Override
public void SpeakButtonClick()
{
SpeechSvc.StopSpeaking(); //This is specific to my robot
ListenSvc.setIsListening(true); //This is specific to my robot
SoundSvc.StopMusicCommand(); //This is specific to my robot
//The following is the key code for starting to listen
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, “voice.recognition.test”);
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,5);
_SpeechRecognizer.startListening(intent);
}
}
//The following is some basic code for a speech recognition listener
public class ListenSvc implements RecognitionListener
{
private static final String TAG = “ListenSvc”;
private String _Text = “”;
private static boolean _IsListening = false;
public void onReadyForSpeech(Bundle params)
{
}
public void onBeginningOfSpeech()
{
}
public void onRmsChanged(float rmsdB)
{
}
public void onBufferReceived(byte[] buffer)
{
}
public void onEndOfSpeech()
{
}
public void onError(int error)
{
}
public void onResults(Bundle results)
{
ListenSvc.setIsListening(false);
String str = new String();
Log.d(TAG, "onResults " + results);
ArrayList data = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
for (int i = 0; i < data.size(); i++)
{
Log.d(TAG, "result " + data.get(i));
str += data.get(i);
}
_Text = "results: " + String.valueOf(data.size());
if(data.size() > 0)
{
SpeechSvc.ProcessSentence(data.get(0).toString());
}
}
public void onPartialResults(Bundle partialResults)
{
}
public void onEvent(int eventType, Bundle params)
{
}
public static void setIsListening(boolean listening) {
_IsListening = listening;
}
public static boolean IsListening() {
return _IsListening;
}
}
//The following is some basic code for receiving the speech text
public class SpeechSvc
{
public void ProcessSentence(string speech)
{
//Do something with speech here
}
}
A Raspberry Pi and Jasper
I would suggest a Raspberry Pi and Jasper. Jasper is a front end to an open source speech recognition engine (PocketSphinx).
The good thing is that Jasper is free and pretty much designed to do what you need it to do. A RasPi is fairly inexpensive (around $35 to $45).
There is also an Odroid for a bit less than $35 that will also do the trick.
While an Android will do the job, it won’t do the speech recognition if disconnected from the internet. It’s a very nice machine, but I think it’s overkill for this project.
Python speech recog library.
I would suggest you use this speech recognition library designed for Python.
https://pypi.python.org/pypi/SpeechRecognition/
It is very easy to implement, all the recognition is transcribed by Googles speech recognition API which has great (arguably the best?) accuracy. You can specify several languages, or even accents (English / American English /Indian English etc etc).
You will require an internet connection for it to work as it fires off to the googles servers. If having an internet connection is an issue, you might want to look into doing this on android, you can use the same google speech API through android, but many of them support offline recognition as well. Using the “SpeechRecognizer” class that Martin (mrtriplett) posted on the previous page.
Here is a link to get offline recognition working - http://stackoverflow.com/questions/17616994/offline-speech-recognition-in-android-jellybean
The good thing about this library is also that it provides free form dictation, so it is not restricted to phrases/keywords you tell it to recognize, it will have a full dictionary of words/phrases. This allows you ALOT more freedom to say natural phrases that you havn’t pre-though out. If your project is a speech recognition elevator, you might not need this dictation as you have only a small amount of phrases you want to recognize, but it can’t hurt.
It’s worth noting that the API key for the Python library was reverse engineered out of chrome, so if Google decided to stop this library working, they could, without warning or offical support for it. (This has not been a problem so far and i’ve been using it for the best part of a year) So for something like a school project it will be fine, but don’t try and make any money from the software, or you might end up with some angry customers
Hope this helps, maybe once you have it working, do a post on it so we can see how you got on.
re: Python & Android Offline Recognition
Thanks very much for this post! I have uses for the python module and the android offline piece. Awesome!
No problem, Look forward to
No problem,
Look forward to seeing what you do with them!