Speech to Text, without buttons? Is that possible?

Hello fellow UiPathers!

I am currently working on a bot with speech recognition. I would like to create sort of a conversation with the robot. However, it is unclear to me how to use speech recognition without using buttons.
Speech

My goal is to use text to speech for letting the robot ask the questions such as “What is your Lastname” then I would like to use Speech to text for, lets say, 5 seconds. This way the user has a timeframe to give an answer.

Is there anybody that could tell me how to make it this way?

Kr, ElectricBoogie

Hi,
The below chain might help you.

Let us know if this helps, we will have a workaround
Regards,
Pavan H

Hello @pavanh003,

I see no chain… :confused:

Kr, ElectricBoogie

Hey,
Sorry

The above link is to convert from text to speech for vice versa
I have tried with python code where will write python code in P3.6 version and then use UiPath python activites to fetch the result and put into a string.

Let us know if you need more info on this.

Regards,
Pavan H

Hey @pavanh003,

I have tried it but it doesn’t seem to be that accurate (tried several accents). It is using Microsofts speech recognition. I am using Google’s at the moment which is very accurate! Personally this is hard to say since I am a fan of Microsoft.

Is there a way to use Google’s speech recognition combined with the python activities? *Maybe a strange question to ask.

Kr, ElectricBoogie

1 Like

Hey @pavanh003,

Do you maybe have an example of how to use the python code? I have received the following from UiPath but I have difficulties putting it to work.

static async Task StreamingMicRecognizeAsync(int seconds)
{
if (NAudio.Wave.WaveIn.DeviceCount < 1)
{
Console.WriteLine(“No microphone!”);
return -1;
}
var speech = SpeechClient.Create();
var streamingCall = speech.StreamingRecognize();
// Write the initial request with the config.
await streamingCall.WriteAsync(
new StreamingRecognizeRequest()
{
StreamingConfig = new StreamingRecognitionConfig()
{
Config = new RecognitionConfig()
{
Encoding =
RecognitionConfig.Types.AudioEncoding.Linear16,
SampleRateHertz = 16000,
LanguageCode = “en”,
},
InterimResults = true,
}
});
// Print responses as they arrive.
Task printResponses = Task.Run(async () =>
{
while (await streamingCall.ResponseStream.MoveNext(
default(CancellationToken)))
{
foreach (var result in streamingCall.ResponseStream
.Current.Results)
{
foreach (var alternative in result.Alternatives)
{
Console.WriteLine(alternative.Transcript);
}
}
}
});
// Read from the microphone and stream to API.
object writeLock = new object();
bool writeMore = true;
var waveIn = new NAudio.Wave.WaveInEvent();
waveIn.DeviceNumber = 0;
waveIn.WaveFormat = new NAudio.Wave.WaveFormat(16000, 1);
waveIn.DataAvailable +=
(object sender, NAudio.Wave.WaveInEventArgs args) =>
{
lock (writeLock)
{
if (!writeMore) return;
streamingCall.WriteAsync(
new StreamingRecognizeRequest()
{
AudioContent = Google.Protobuf.ByteString
.CopyFrom(args.Buffer, 0, args.BytesRecorded)
}).Wait();
}
};
waveIn.StartRecording();
Console.WriteLine(“Speak now.”);
await Task.Delay(TimeSpan.FromSeconds(seconds));
// Stop recording and shut down.
waveIn.StopRecording();
lock (writeLock) writeMore = false;
await streamingCall.WriteCompleteAsync();
await printResponses;
return 0;
}

I look forward hearing from you!

Kr, Paul

Hi,
Not sure how you are doing,
I have used the python activities available in studio to connect to the python code having python code saved in a location
Giving the path and using python activities get the result into a variable in uipath.

Let us know if this helps,
Regards,
Pavan H

can you provide that python complete coding please

When I am trying to integrate the code in Uipath using python activity I am getting the following error with Invoke Python Method.

Please help me with this if you have any idea.