question

EduardoGomez-1870 avatar image
0 Votes"
EduardoGomez-1870 asked CherryBu-MSFT commented

voice to text

Hello

I was just wondering if somebody has implemented voice to text in Xamarin forms, and if you could share an example

I search everywhere, and the only solution I can fin is AzureSpeech, but this is not a great solution become I need to upload a recording

I also tried to implement this (https://github.com/dev-aritra/XFSpeech), but no luck

dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

CherryBu-MSFT avatar image
0 Votes"
CherryBu-MSFT answered CherryBu-MSFT commented

Hello,

Welcome to our Microsoft Q&A platform!

I also tried to implement this (https://github.com/dev-aritra/XFSpeech), but no luck

I download this sample to test, and I have no problem, please take a look the following step:

Firstly, you need to connect network successfully.

Then run this sample, click Start Button , you will see this screnshot, you can speak something now.

92492-image-10.png

If you want to stop speak, don't tap or click any place, wait a minute, it will disappear automatically.

About RecognizerIntent Class, please take a look the following code, I have made some comments.

  // create the intent and start the activity
                         var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
                         voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm);
    
                         // put a message on the modal dialog
                         voiceIntent.PutExtra(RecognizerIntent.ExtraPrompt, Application.Context.GetString(Resource.String.messageSpeakNow));
    
                         // if there is more then 1.5s of silence, consider the speech over
                         voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 1500);
                         //The amount of time that it should take after we stop hearing speech to consider the input possibly complete.
                         voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1500);
                         //The minimum length of an utterance.
                         voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 15000);
                         voiceIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1);
    
                         // you can specify other languages recognised here, for example
                         // voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.German);
                         // if you wish it to recognise the default Locale language and German
                         // if you do use another locale, regional dialects may not be recognised very well
    
                         voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default);
                         StartActivityForResult(voiceIntent, VOICE);

Best Regards,

Cherry Bu


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



image-10.png (28.7 KiB)
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the help, I don't know why it was not working for me, how do I do if I want to stop the recording when I press a button?

0 Votes 0 ·

Hi @EduardoGomez-1870 run this sample, click Start Button, you can speak and start recording now. If you want to stop this recording, don't tap or click any place, wait a minute, it will disappear automatically.

0 Votes 0 ·

And what if you want to dismiss it with a button

0 Votes 0 ·
Show more comments