示例#1
0
        public void TestCongnitiveSpeechSynthesis()
        {
            SpeechSynthesizer synthesizer = new SpeechSynthesizer(new Uri(SynthesisUri), SubscriptionKey);
            Stopwatch         stopWatch   = Stopwatch.StartNew();
            Stream            stream      = synthesizer.GetSynthesizedData("ÄãºÃÄãºÃ¡£", new SynthesisParams {
                Language = "zh-CN", VoiceFont = VoiceName
            },
                                                                           AudioEncode.Mp3Mono16K128Br);

            _output.WriteLine(stopWatch.ElapsedMilliseconds.ToString());
            Assert.NotNull(stream);
            Assert.True(stream.Length > 0);
#if DEBUG
            stream.Seek(0, SeekOrigin.Begin);
            stream.CopyTo(new FileStream(Path.Combine(_outputDirInfo.FullName, "ttsresult.mp3"), FileMode.Create));
#endif
        }