【问题标题】:Changing output device for tts program written in C# not working in Windows 10更改用 C# 编写的 tts 程序的输出设备在 Windows 10 中不起作用
【发布时间】:2021-06-24 01:56:14
【问题描述】:

当我尝试在用 C# 编写的 tts 控制台应用程序的高级音频设置中将输出设备更改为虚拟电缆时,音频会在我的普通设备上播放。我该如何解决?代码:

using System;
using System.Speech.Synthesis;
namespace hhhh
{
    class Program
    {
        static void Main(string[] args)
        {

            Console.WriteLine("Initialized");

            while (true)
            {
                SpeechSynthesizer synthesizer = new SpeechSynthesizer();

                synthesizer.Speak(Console.ReadLine());

            }
        }

       }
    }

【问题讨论】:

  • 我已经知道怎么用了。我不知道为什么将音频设备更改为我的虚拟电缆不起作用

标签: c# windows audio


【解决方案1】:

您可能必须配置 synthesizer 对象以在特定设备上监听,即默认 synthesizer.SetOutputToDefaultAudioDevice() 或特定目标设备 synthesizer.SetOutputToAudioStream(deviceout, audioformat);

看看this documentation

【讨论】:

  • 一个例子会有所帮助。什么是设备输出?
  • 我也认为你误解了我的问题。我想将音频发送到我的另一条虚拟电缆。
猜你喜欢
  • 2016-03-28
  • 2018-08-09
  • 2023-03-21
  • 2018-02-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-08-27
  • 1970-01-01
相关资源
最近更新 更多