Original Discord Post by hiimabiel | 2024-09-19 15:18:23
Hello, I was wondering how I could send a message to my Convai character through script. I’m using voice and I created an additional module to determine emotion, so I need to send the message to Convai with this information. For example:
If I say: “Hello, John. Is everything okay?”.
I will have my system to determine emotion and automatically add to the sentence the emotion so it looks like the following:
“Hello, John. Is everything okay? (asterisk) Asks in a concerned and empathetic way (asterisk).”.
How can I modify through script the message that is being sent to Convai? Thank you!
Yeah, I’ve been looking at it and also the StopRecordAudio() and ProcessAudioChunk() methods, and it seems like the audio gets converted to a bit stream and sent to the server. Does it get sent like this or as a String? Is there any way to append any information to that stream?
I am assuming you want to send a text request only, and if that is what you want then you can get a reference of the active NPC and use that to call a function called SendTextData and you can pass the data to it
Make the NPC you want to say the stuff the active NPC by calling
ConvaiNPCManager.Instance.SetActiveConvaiNPC([Your-NPC-reference], false)
Send the text to convai server using speak tag method
[Your-NPC-reference].SendTextDataAsync([Your Text])
Reply by petroslouca | 2024-09-21 19:19:32
Hello <@433610960725344267> and <@1023671043287699568> , I am using Unity and I want to make the character speak a specific text that I provide in a script, I managed to have it displayed inside the chatbox UI but I need also the character to say it, to speak it. Could you please provide the steps to accomplish this?
Yes! The speak tags did the work, could you please point me to the specific documentation part for more information about this? Please note that I am using Unity.