Example #1
0
    static void Main()
    {
        var response = new VoiceResponse();
        var say      = new Say("Hi", voice: "Polly.Joanna");

        say.Break(strength: "x-weak", time: "100ms");
        say.Emphasis("Words to emphasize", level: "moderate");
        say.P("Words to speak");
        say.AddText("aaaaaa");
        say.Phoneme("Words to speak", alphabet: "x-sampa", ph: "pɪˈkɑːn");
        say.AddText("bbbbbbb");
        say.Prosody("Words to speak", pitch: "-10%", rate: "85%", volume: "-6dB");
        say.S("Words to speak");
        say.SayAs("Words to speak", interpretAs: "spell-out", role: "yyyymmdd");
        say.Sub("Words to be substituted", alias: "alias");
        say.W("Words to speak");
        response.Append(say);

        Console.WriteLine(response.ToString());
    }
Example #2
0
        public void TestElementWithChildren()
        {
            var elem = new Say();

            elem.Break(SsmlBreak.StrengthEnum.None, "time");

            elem.Emphasis("words", SsmlEmphasis.LevelEnum.Strong);

            elem.Lang("words", SsmlLang.XmlLangEnum.DaDk);

            elem.P("words");

            elem.Phoneme("words", SsmlPhoneme.AlphabetEnum.Ipa, "ph");

            elem.Prosody("words", "volume", "rate", "pitch");

            elem.S("words");

            elem.SayAs("words", SsmlSayAs.InterpretAsEnum.Character, SsmlSayAs.RoleEnum.Mdy);

            elem.Sub("words", "alias");

            elem.W("words", "role");

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Say>" + Environment.NewLine +
                "  <break strength=\"none\" time=\"time\"></break>" + Environment.NewLine +
                "  <emphasis level=\"strong\">words</emphasis>" + Environment.NewLine +
                "  <lang xml:lang=\"da-DK\">words</lang>" + Environment.NewLine +
                "  <p>words</p>" + Environment.NewLine +
                "  <phoneme alphabet=\"ipa\" ph=\"ph\">words</phoneme>" + Environment.NewLine +
                "  <prosody volume=\"volume\" rate=\"rate\" pitch=\"pitch\">words</prosody>" + Environment.NewLine +
                "  <s>words</s>" + Environment.NewLine +
                "  <say-as interpret-as=\"character\" role=\"mdy\">words</say-as>" + Environment.NewLine +
                "  <sub alias=\"alias\">words</sub>" + Environment.NewLine +
                "  <w role=\"role\">words</w>" + Environment.NewLine +
                "</Say>",
                elem.ToString()
                );
        }