Android detect speech recognition language - java

I am working in an application that recognizes user voice and convert it to decimal , it should detect two languages Arabic , and English.
This my Intent to detect user input:
Intent voicerecogize = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
voicerecogize.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "ar-eg");
startActivityForResult(voicerecogize, RESULT_SPEECH);
I need a method to detect which language user speaks either Arabic or English.

You can not listen for 2 languages at the same time with the current Android Speech Recognition API.
You can only listen for one language at a time.
What you could do is record the user input and then push the recorded input to one speech recognizer for English and one for Arabic, but there is no out-of-the-box API to do this.

Related

How to change gender of text to speech voice in an Android project? [duplicate]

This question already has answers here:
Android Text To Speech Male Voice
(8 answers)
Closed 1 year ago.
My app waits for an input from the user for their gender: male or female. If the user chooses male, then the text-to-speech voice will be in a male's voice, if the user chooses female, it will be in female voice. The language is always English, I just want to change the gender of the TTS voice. How do I do that?
My code to initiate TTS:
TextToSpeech TTS;
TTS.setLanguage(new Locale("en_EN"));
TTS.speak("hello i am speaking in your gender",TextToSpeech.QUEUE_FLUSH,null,null);
The on-board TTS for Android doesn't directly support voice gender or much of anything. The standard installation has just a few fixed voices in a few languages. Users can install different TTS engines and different TTS voices, and there are methods that you can use to query the available voices, but this probably won't help you solve this problem.
I suggest that you look at Google cloud text to speech as this offers many language choices is many languages including different genders, etc.

How to switch microphone between Bluetooth earpiece and mobile phone?

I try to write a Speech2speech translation app and the translation service is from Microsoft speech service api.
There are two function I want:
One of them is that earpiece receives my voice(English), and then, the speaker of mobile phone plays the translated result(Japanese).
The other one is that built-in microphone of mobile phone receives someone's voice(Japanese), and then, the earpiece plays the translated result(English).
I try some combinations of these settings, but I still find the correct combination to achieve my goal.
AudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION)
AudioManager.stopBluetoothSco()
AudioManager.setBluetoothScoOn();
AudioManager.setSpeakerphoneOn();
And all of "AudioManager.setMode"
For function 1:
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
mAudioManager.stopBluetoothSco();
mAudioManager.setBluetoothScoOn(false);
mAudioManager.setSpeakerphoneOn(true);
For function 2:
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
mAudioManager.setMicrophoneMute(false);
mAudioManager.startBluetoothSco();
mAudioManager.setBluetoothScoOn(true);
mAudioManager.setSpeakerphoneOn(false);
Above code is what I use right now.
But both of them receive the voice from built-in microphone of mobile phone and play the translated result on earpiece.
Is there any simple or clear way to select the input or output of audio?

Detect Language From RecognizerIntent

i write this code:
Intent voiceSearchIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
voiceSearchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
startActivityForResult(voiceSearchIntent, 1);
i want to detect the language of speeched sentence. But when i run the intent it listens only English(US) language:
is possibile run the Intent in generic mode and retrieve the spoken sentence?
Thanks so much.
No, it's not possible. Speech reconition algorithm is designed in the way that it only works with a single language.
You have to create a language detection solution on your own, for example, you can run a handmade phonetic recognizer created with CMUSphinx and apply a classifier on a decoded sequence of phonemes to get a language. There are more advanced algorithm for language identification, see the review for initial links:
http://www.cslu.ogi.edu/HLTsurvey/ch8node9.html
It's not an easy task and it's definitely not robust. It's way easier to present user a list of languages to choose.

convert serial port sounds into microphone input

Assume that there are two computers, two headsets with microphone.One PC (A) is having a user and one PC (B) does not have a user, but it is having a software which makes automated calls. Now B making a call to A and Playing something like "Please say 'DONE' if you already in your seat." Then A response for it by saying "DONE". Now here what I want to do is, When that person response it comes to the speaker as incoming audio.I want to make that same incoming voice as the input for microphone. because my voice recognition software only convert microphone inputs to words.
If someone understand my problem please reply/advice me. Upto now I used a windows function in my sound card (Listen to the device), but as the solution its not worthy since that voice is not clear and voice volume not enough for voice recognition.
Thank you.

Read SMS in other language except English

My application sends and receives message in English.But I want a functionality by which, whenever a new message is received,it would be in English,but when user reads message it should be readable in Hindi language.
Is there any solution for that??
Use the google api
Google Java Translation

Categories

Resources