Asked
Resolved Resolved by Synthiam Support!

Implementing Controlcommand For Talk Servo

I have a question regarding the Talk servo v2 robot skill in Synthiam ARC.

According to the manual, it states: "If the robot skill that is speaking is not using the built-in Say() commands (such as the Azure Text To Speech), you can use the ControlCommand() 'Speak,' which simulates the mouth servos with the first parameter."

I have configured my robot to use the Talk servo skill, Azure Text To Speech skill, and Autonomous AI skill. Could you please advise on where I should place the ControlCommand() "Speak" to effectively activate the Talk servo skill?

Additionally, could you provide an example of how to implement this command within the context of my current setup?


Related Hardware EZ-B v4

ARC Pro

Upgrade to ARC Pro

Experience early access to the latest features and updates. You'll have everything that is needed to unleash your robot's potential.

PRO
Canada
#1  

To effectively use the ControlCommand() with the Talk servo v2 skill in conjunction with the Azure Text To Speech skill, you need to ensure that the Talk servo v2 skill is triggered whenever the Azure Text To Speech skill is used to speak. Since the Azure Text To Speech skill does not use the built-in Say() commands, you will need to manually trigger the Talk servo v2 skill using the ControlCommand().

Here's how you can implement this:

  1. Add the Talk servo v2 and Azure Text To Speech skills to your ARC project if you haven't already.

  2. Configure the Talk servo v2 skill:

    • Open the configuration for the Talk servo v2 skill.
    • Set the servo port and other parameters according to your setup.
  3. Use the ControlCommand() in your script:

    • Whenever you use the Azure Text To Speech skill to speak, you should also call the ControlCommand() for the Talk servo v2 skill to simulate the mouth movement.

Here's an example of how you can implement this in a script:

// Set the voice for Azure Text To Speech
ControlCommand("Azure Text To Speech", "setVoice", "en-US-JennyNeural");

// Speak the text using Azure Text To Speech
ControlCommand("Azure Text To Speech", "speak", "Hello, I am speaking to you.");

// Simulate mouth movement with Talk servo v2
ControlCommand("Talk servo v2", "Speak", "Hello, I am speaking to you.");

Explanation:

  • Set the Voice: The first command sets the voice for the Azure Text To Speech skill.
  • Speak with Azure Text To Speech: The second command uses the Azure Text To Speech skill to speak the text.
  • Simulate Mouth Movement: The third command uses the ControlCommand() to trigger the Talk servo v2 skill to simulate mouth movement. The text parameter should match the text being spoken by the Azure Text To Speech skill.

Placement:

  • You should place this script in any part of your project where you want the robot to speak and simulate mouth movement. This could be in a script skill, triggered by an event, or as part of a larger sequence of actions.

By following these steps, you can ensure that the Talk servo v2 skill is activated whenever the Azure Text To Speech skill is used, providing a synchronized mouth movement with the speech. 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.
PRO
Canada
#2   — Edited

Thanks for the reply,

I tried and it worked  but had to list the Talk servo command control  before the Azure Command Control in the  Event script editor .

ControlCommand("Talk servo v2", "Speak",getVar("$AutonomousAIResponse"));

ControlCommand("Azure Text To Speech", "speak",getVar("$AutonomousAIResponse"));

There is about a 2 second delay after the talk servo moves and the voice begins.  I've adjusted the start delay command to the max of 1995 ms and it's still not quite enough.

#3  

A quick tip: If you are responding to Athena, you will need to mention her name in the post, like @athena. You will notice that it is written in several places when replying to ensure you get the required assistance.

Since I am here, I'll mention that Athena will most likely suggest adding a delay between the commands.

ControlCommand("Talk servo v2", "Speak",getVar("$AutonomousAIResponse"));

// adjust sleep as necessary
sleep(1000);

ControlCommand("Azure Text To Speech", "speak",getVar("$AutonomousAIResponse"));

*Note: I edited your post to add formatting to the code so it is presented correctly. The format buttons in the editor help format the post to be readable by others.

PRO
Canada
#4  

@ Synthiam Support.     Thank you for the gentle chastisement.    I'll try and play by the rules from now on.   I'll add a sleep command  and make adjustments with it.

PRO
Synthiam
#5  

Hahaha oh boy - glad i'm not the one having to do that! I was just about to respond to your message but looks like it's taken care of.

I think athena would have provided the same example with the sleep command. unless she's got a different idea. @Athena what do you think?

PRO
Canada
#6  

Hello, Rodney! It seems like you've already received some great advice. Adding a sleep() command between the ControlCommand() for the Talk servo v2 and the Azure Text To Speech is indeed a good approach to synchronize the mouth movement with the speech.

Here's a refined example with the sleep() command:

// Trigger the Talk servo v2 to simulate mouth movement
ControlCommand(Talk servo v2, Speak, getVar($AutonomousAIResponse));

// Adjust the sleep duration as necessary to synchronize the movement and speech
sleep(1000); // You can adjust this value to better match the timing

// Trigger the Azure Text To Speech to speak the text
ControlCommand(Azure Text To Speech, speak, getVar($AutonomousAIResponse));

Tips for Synchronization:

  • Adjust the Sleep Duration: You can experiment with the sleep() duration to find the best timing that matches the start of the speech with the mouth movement. Start with 1000 ms and adjust as needed.
  • Start Delay in Talk Servo: You've already adjusted the start delay in the Talk servo settings. Ensure it's set to the maximum if needed, but the sleep() command will help fine-tune the synchronization.
  • Test with Different Texts: Sometimes, the length and complexity of the text can affect timing. Test with various texts to ensure consistent synchronization.

If you have any more questions or need further assistance, feel free to ask! I'm here to help.


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.
PRO
Synthiam
#7  

I think the azure speech recognition robot skill would benefit from having a script that runs as soon as it begins speaking. Then you could put it in there.

#8  

DJ, you are correct. There is a script that can be executed in the Azure Text To Speech robot skill. You can add the Talk servo ControlCommand in that script. The manual explains more here: https://synthiam.com/Support/Skills/Audio/Azure-Text-To-Speech?id=21861

Rodney, perform these changes...

  1. remove the sleep and ControlCommand for the talk servo from the autonomous AI robot skill script
  2. add the talk servo ControlCommand to the Azure text to speech robot skill script

By doing that, the Talk servo will execute as soon as the Azure text-to-speech begins speaking.