tropo

Unable to change say voice in Tropo MVC


I'm using the Tropo MVC classes and have a problem with changing the voice in the say. Setting the voice property of the say object does not seem to change the voice for example:

                Say say1 = new Say("This is first voice");
                say1.Voice = "susan";
                Say say2 = new Say("This is the male voice");
                say2.Voice = "dave";
                List<Say> sayList = new List<Say>();
                sayList.Add(say1);
                sayList.Add(say2);
                Script.Ask(null, null, new Choices("[1 DIGIT]", "dtmf", "#"), null, strArgs, true, sayList, Convert.ToSingle(action.Timeout));

The voice does not change. In fact it appears that the only way to change the voice is to set Script.Voice = "voice" which doesn't work for me as I have to handle language select in the first Ask which requires English voice followed by French voice.


Solution

  • Tropo also supports SSML, which is a super powerful markup language for mixing voices and adjusting voice tempo/cadence.

    You can mix voices in a single Say command by doing something like:

    new Say("<?xml version='1.0'?><speak>For English please press 1.<voice name='Carlos' xml:lang='es'>para el español por favor pulse 2</voice></speak>")
    

    The inline XML is kinda yukkie but it gets the job done and learning SSML will allow you to create some really professional-sounding apps.