BotFramework-WebChat icon indicating copy to clipboard operation
BotFramework-WebChat copied to clipboard

Speech and mic on/off control

Open puripuneet opened this issue 8 years ago • 13 comments

It seems that by default speech turns on only when the microphone icon is manually clicked -- in other words, the bot speaks to the user only after the user clicks on the microphone icon to speak to it first. This doesn't work well in some scenarios, for example, when we want the bot to speak out a greeting at startup, instead of just displaying it as text.

Also, the inputHint value of "expectingInput" from the bot framework only turns on the microphone for a couple of seconds. How to make the mic stay on longer, or ideally until inputHint value of "acceptingInput" or "ignoringInput" is received from the bot framework?

puripuneet avatar Feb 09 '18 20:02 puripuneet

Same problem here!

I would like that bot start speaking by voice without need that user use "mic" button before.

Is it possible to do it?

DanielTizon avatar Feb 24 '18 09:02 DanielTizon

@puripuneet sounds great idea.

For the first problem, do you mean TTS (text-to-speech) is only available when the microphone is clicked for this first time?

Currently, we don't have API to control the microphone button programmatically (unless you hack into our Redux store and send a Listening_Starting action).

For the second issue, always-on microphone sounds great idea. When we detect silence for 5 seconds, we will stop listening, regardless whether it is related to expectingInput or not. Maybe we can add an option there.

compulim avatar Mar 07 '18 20:03 compulim

@compulim the answer is "yes" to your question "For the first problem, do you mean TTS (text-to-speech) is only available when the microphone is clicked for this first time?"

puripuneet avatar Mar 09 '18 04:03 puripuneet

@compulim Any updates on the always-on option for the microphone?

matmatos avatar Sep 20 '18 13:09 matmatos

Is there any update on this. We need to enable the mic on chat bot for intervals of time also. Is there any workarounds for this?

GayathriR2018 avatar Oct 31 '18 05:10 GayathriR2018

In v4 (which is going to release tomorrow), we will have API to turn on/off microphone.

But I bet just turning the microphone on/off might not be enough. I need to code a sample to see how it works in continuous speaking mode, there are a few unknowns to me:

  • I think Cognitive Services support continuous dictation, but how it works in real world scenario is unknown to me
    • We might not support the continuous dictation mode by default, we might need to add more code
      • Speech Services has a new SDK, we need to adapt to that new SDK before adding any new features, because the old SDK is deprecating in a year
  • If we keep turning microphone on when it stop, will it miss capturing any audio segments?
  • Which browsers do we need to prime the audio stream? E.g. ask the user to tap a button at welcome, so the browser won't block microphone access

It will be helpful if someone could jump in and we code a demo together.

compulim avatar Oct 31 '18 06:10 compulim

BTW, we coded a "speech button" sample that show how you can write new UI and use API to turn on/off microphone. It's powered by Web Chat minus the UI. It use Cognitive Services Bing Speech services.

You can play the live demo, and see the source code.

[Edited by @corinagum] - Fixed old links.

compulim avatar Oct 31 '18 06:10 compulim

The links are broken

SanaWaseem avatar Feb 17 '19 11:02 SanaWaseem

Links fixed.

corinagum avatar Feb 18 '19 17:02 corinagum

please update us on the issue raised by @puripuneet to TTS part, currently we have no OOTB method to turn it on by default in for example, a welcome card.

adalfa avatar Apr 08 '19 13:04 adalfa

Demo is broken, check console after clicking on mic:

WebSocket connection to 'wss://westus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?language=pt-PT&format=detailed&Authorization=eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9(...)' failed: HTTP Authentication failed; no valid credentials available

Also, current implementation fails to speak text activities in at least 2 cases:

a) when bot sends proactive activities (like welcome message)

b) when user uploads a file and bot replies

How can this be solved? Is there some store event that we can dispatch?


Also, side question if anyone can help me... I need to integrate webchat with google speech API (their recognition and synthesis is better at least for my language...), where can I look for pointers on how to implement a ponyfill for easily integrate with renderWebChat and pass the webSpeechPonyfillFactory?

AndreMantas avatar Oct 15 '19 09:10 AndreMantas

@AndreMantas regarding the error you are receiving on sample 13, could you file a new bug? Please follow the template and that will be a great help.

For speech not speaking text activities, I would suggest filing another issue for that as well, maybe as a Question. We will have to investigate what's going on.

In regards to your implementation questions, we recommend asking these on Stack Overflow). We have engineers that monitor our botframework tag and can help you out.

Thank you!

corinagum avatar Oct 15 '19 22:10 corinagum

Updated links:

https://github.com/microsoft/BotFramework-WebChat/tree/master/samples/06.recomposing-ui/b.speech-ui

https://microsoft.github.io/BotFramework-WebChat/06.recomposing-ui/b.speech-ui/

collegewap avatar Jun 22 '20 06:06 collegewap