Asked
Resolved Resolved by DJ Sures!

Bing Speech With Button

I am currently using the Bing Speech recognition robot skill to activate the Openai Chatgpt robot skill for conversation with my robot. It’s working pretty well but I need to fix 2 things:

I need to activate the conversation with a button press (contact closure) instead of a wake word. What is the best way to go about this? (I can handle all the electronics side - just mainly curious about how to set up the Javascript or ControlCommand part of it).

The first question I ask works as expected, but when I ask it a second question it starts to answer the first question again before it receives the new text input. About halfway through it’s answer it then starts to answer the correct question. How can I fix this issue?

Any help would be greatly appreciated, Thank you!



ARC Pro

Upgrade to ARC Pro

Unlock the true power of automation and robotics by becoming a proud subscriber of Synthiam ARC Pro.

PRO
Synthiam
#9  

@Athena with my change you don't have to worry about a variable with listening while speaking. you can remove that part because the only time the robot can listen is when the button is being held on the microphone. so remove that and only focus on the button being pressed.

PRO
Canada
#10  

Thank you,@DJ_Sures,for the clarification!

You're right;with the button press approach acting like a walkie-talkie,there's no need to manage the $IsSpeaking variable for listening while speaking.Lets simplify the solution accordingly.

Updated Script for Button Press Activation


while(true) { 

// Wait for the button press on D0 
Digital.wait(D0,true);

// Start Bing Speech Recognition 
ControlCommand("Bing Speech Recognition", "StartListening");

// Pause for a bit in case the button is released too quickly 
sleep(500);

// Wait for button to release 
Digital.wait(D0, false);

// Stop listening 
ControlCommand("Bing Speech Recognition", "StopListening");
} 

Updated Script for Bing Speech Recognition


// Send the recognized speech to OpenAI ChatGPT 
ControlCommand("OpenAI ChatGPT", "Send", getVar("$BingSpeech")); 

Updated All Responses Script in OpenAI ChatGPT


// Speak the response 
Audio.say(getVar("$OpenAIResponse"));

Summary:

  • The button press script now runs in a loop,starting and stopping Bing Speech recognition based on the button state.
  • The $IsSpeaking variable and related checks have been removed,simplifying the process.
  • The robot will only listen when the button is pressed,eliminating the need to manage overlapping responses.

By implementing these changes,you should have a streamlined and effective system for activating conversations with a button press.If you have any further questions or need additional assistance,feel free to ask!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#11  

Thanks so much for the quick responses!  I'll try them now and let you know the results