vb.net 通过软件将音频输出路由到麦克风输入
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20953107/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Routing Audio-Output to Microphone-Input by Software
提问by Bliss
I'm using a certain application, processing the audio coming in on sound-card's microphone Hyman. As I need it to process the audio playedon my Windows 7 system, I've physically connected a cable between sound-card's speakers output-Hyman and microphone's input-Hyman.
我正在使用某个应用程序,处理来自声卡麦克风插孔的音频。由于我需要它来处理在我的 Windows 7 系统上播放的音频,我在声卡的扬声器输出插孔和麦克风的输入插孔之间物理连接了一条电缆。
Could this be accomplished by software, e.g. by NAudio?
这可以通过软件完成吗,例如 NAudio?
I've found an answer on this threadwhich seems to describe how to accomplish the opposite route, i.e. microphone-to-speakers, but could not figure how to transform it to do the other way around.
我在这个线程上找到了一个答案,它似乎描述了如何完成相反的路线,即麦克风到扬声器,但无法弄清楚如何将其转换为相反的方式。
I've also found thisnon-answered question, which seems to be close in goal, although bottom-line different.
我还发现了这个未回答的问题,尽管底线不同,但它的目标似乎很接近。
I'm using VB.Net 2010. Target platform is Windows 7 or above.
我使用的是 VB.Net 2010。目标平台是 Windows 7 或更高版本。
Using an external audio-routing application such as 'Virtual Audio Cable' is currently not a valid option.
使用外部音频路由应用程序(例如“虚拟音频电缆”)目前不是有效选项。
采纳答案by Roman R.
To route audio output as another application's input you need to be able to take care of the following:
要将音频输出路由为另一个应用程序的输入,您需要能够处理以下事项:
- To select specific audio output on the playing application
- To select specific audio input on the recording/processing application
- To connect input and output together
- 在播放应用程序上选择特定的音频输出
- 在录音/处理应用程序上选择特定的音频输入
- 将输入和输出连接在一起
There are a few ways to achieve the mentioned items.
有几种方法可以实现上述项目。
An obvious solution is hardware loopback. This covers #3 above and others are covered by plugging cable into proper connectors. No software needed, but there are obvious drawbacks: overhead, noise and possible quality loss due to DAC and ADC conversions, inability to use certain multi-channel formats.
一个明显的解决方案是硬件环回。这涵盖了上面的#3,其他的则通过将电缆插入正确的连接器来涵盖。不需要软件,但有明显的缺点:开销、噪声和可能由于 DAC 和 ADC 转换导致的质量损失,无法使用某些多通道格式。
Then, you can install Virtual Audio Cable which creates a pair of devices connected behind the scenes. You marked this solution as unsatisfactory, so we are skipping it.
然后,您可以安装 Virtual Audio Cable,它可以创建一对在幕后连接的设备。您将此解决方案标记为不满意,因此我们将跳过它。
Next option is software loopback device. This option is hardware dependent and available on many onboard audio devices. Playback happens as usually and you have an additional audio input device available that produces a copy of audio feed sent to hardware output. Once you enable this device (typically disabled by default) you need to use this device as audio input on your processing application. See Is it possible to record sound played on the sound card?for details. This is similar to hardware loopback but without a physical cable. Same drawbacks apply. Supposedly, this is the closest to your needs.
下一个选项是软件环回设备。此选项取决于硬件,可在许多板载音频设备上使用。播放与往常一样,您有一个额外的音频输入设备可用,它可以生成发送到硬件输出的音频馈送副本。启用此设备(通常默认情况下禁用)后,您需要将此设备用作处理应用程序的音频输入。请参阅是否可以录制声卡上播放的声音?详情。这类似于硬件环回,但没有物理电缆。同样的缺点也适用。据说,这是最接近您的需求的。
And then another option is a pair of software only pair of virtual audio devices. Similar to Virtual Audio Cable, but having specific applications consumers of these devices it is possible to implement the devices in user mode without third party app setup, without necessity of administrative permissions in particular. I am not aware of any out of the box implementations and this is unlikely to be a solution for you if you are going to stay with VB.NET only (that is, needs advanced programming anyway, even though no need for a kernel-mode driver).
然后另一个选项是一对纯软件的虚拟音频设备。类似于虚拟音频电缆,但具有这些设备的特定应用程序消费者,可以在用户模式下实现设备而无需第三方应用程序设置,尤其不需要管理权限。我不知道任何开箱即用的实现,如果您只打算使用 VB.NET(也就是说,无论如何都需要高级编程,即使不需要内核模式),这不太可能是您的解决方案司机)。
回答by Mark Heath
Unfortunately not with NAudio, because you'd need to create a fake audio input device. You really do need something like a Virtual Audio Cable to accomplish this task. That's because to make a sound device appear in windows, you'll need to write a driver to do this.
不幸的是,NAudio 不能,因为您需要创建一个假的音频输入设备。您确实需要像虚拟音频电缆这样的东西来完成这项任务。这是因为要使声音设备出现在 Windows 中,您需要编写驱动程序来执行此操作。
Also, you'd need to beware of creating a feedback loop with the setup you describe.
此外,您需要注意使用您描述的设置创建反馈循环。
回答by 123onetwothree
Man ,
男人 ,
Right click audio icon and select Recording Devices, right click and select Show Disabled Devices and StereoMix should apprear. Enable StereoMix and then select in your application (Skype, TeamSpeak or whatever) the StereoMix as Input Device and that's it.
右键单击音频图标并选择录音设备,右键单击并选择显示禁用的设备,StereoMix 应该会出现。启用 StereoMix,然后在您的应用程序(Skype、TeamSpeak 或其他)中选择 StereoMix 作为输入设备,就是这样。

