简体   繁体   English

更改SpeechSynthesizer的音频输出设备

[英]Change audio output device for SpeechSynthesizer

I'm doing some tests with the speech functions on C#, but I don't know how do I change the Audio Output Device from default to another one, in this case Virtual Audio Cable . 我正在使用C#上的语音功能进行一些测试,但是我不知道如何将音频输出设备从默认更改为另一种,在本例中为Virtual Audio Cable

My function: 我的功能:

    private void Say()
    {
        using (SpeechSynthesizer synth = new SpeechSynthesizer())
        {
            string str = textBox1.Text;

            //synth.SetOutputToDefaultAudioDevice();
            synth.Volume = 100;
            synth.Rate = 2;
            synth.Speak(str);
        }
    }

This is streaming the audio to my default playback device, but I want it to stream to Virtual Audio Cable one. 这会将音频流式传输到我的默认播放设备,但我希望它流式传输到虚拟音频电缆。 How can I do that? 我怎样才能做到这一点?

There are some functions but I don't know if they are used for this: 有一些功能,但我不知道它们是否用于此目的:

  1. SetOutputToAudioStream SetOutputToAudioStream
  2. SetOutputToWaveStream SetOutputToWaveStream

Can someone help me? 有人能帮我吗? Thanks =P 谢谢= P

刚刚想出了使用naudio.codeplex.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM