alessandroTironi / Unity-DialogflowV2Agents

A client for Google Dialogflow V2 APIs that allows to model conversational agents.
MIT License
27 stars 9 forks source link

How to change voice male or female? #11

Closed danglove113 closed 1 year ago

danglove113 commented 3 years ago

Hi, How to change voice male or female?

danglove113 commented 3 years ago

I have done.

-Create file SynthesizeSpeechConfig.cs

using Newtonsoft.Json;

//@danglove113 namespace Syrus.Plugins.DFV2Client { [JsonObject] public class SynthesizeSpeechConfig { [JsonProperty] public Voice Voice { get; set; } }

[JsonObject]
public class Voice
{
    [JsonProperty]
    public string ssmlGender { get; set; }
}

}

-add more code below in DF2OutputAudioConfig: [JsonProperty] public SynthesizeSpeechConfig SynthesizeSpeechConfig { get; set; }

-add more code below in DialogFlowV2Client //@danglove113 request.OutputAudioConfig.SynthesizeSpeechConfig = new SynthesizeSpeechConfig(); request.OutputAudioConfig.SynthesizeSpeechConfig.Voice = new Voice(); request.OutputAudioConfig.SynthesizeSpeechConfig.Voice.ssmlGender = "SSML_VOICE_GENDER_MALE";

Thank you @alessandroTironi and @hoatong