如何捕获正在播放的音频? [英] How do I capture the audio that is being played?

查看:267
本文介绍了如何捕获正在播放的音频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁知道如何以编程捕获(即从声卡的到来,而不是输入设备如麦克风也就是一切)正被播放的声音。

Does anyone know how to programmatically capture the sound that is being played (that is, everything that is coming from the sound card, not the input devices such as a microphone).

推荐答案

假设你正在谈论的Windows,基本上有三种方法可以做到这一点。

Assuming that you are talking about Windows, there are essentially three ways to do this.

首先是要打开音频设备的主要输出作为记录源。这是唯一可能在驱动程序支持它,尽管大多数做的这些日子。虚拟设备的通用名称是你所听到的声音和波形输出。您需要使用合适的API(见WaveIn或DirectSound的MSDN中)做捕获。

The first is to open the audio device's main output as a recording source. This is only possible when the driver supports it, although most do these days. Common names for the virtual device are "What You Hear" or "Wave Out". You will need to use a suitable API (see WaveIn or DirectSound in MSDN) to do the capturing.

的第二种方式是把它写到达物理设备之前,可以拦截音频流的过滤驱动器。此外,这项技术将只用于有合适的驱动程序的拓扑装置工作,它肯定不是为懦弱。

The second way is to write a filter driver that can intercept the audio stream before it reaches the physical device. Again, this technique will only work for devices that have a suitable driver topology and it's certainly not for the faint-hearted.

这意味着,没有这些选项将保证任意硬件在PC上运行。

This means that neither of these options will be guaranteed to work on a PC with arbitrary hardware.

最后一个选择是使用一个虚拟的音频设备,如虚拟音频电缆。如果此设备在Windows中设置为defualt播放设备,那么所有表现良好的应用程序将通过玩耍。然后,您可以从相同的设备录制捕捉叠加输出。只要你有超过你想要录制的应用程序使用此选项可以永远是可行的设备控制。

The last alternative is to use a virtual audio device, such as Virtual Audio Cable. If this device is set as the defualt playback device in Windows then all well-behaved apps will play through it. You can then record from the same device to capture the summed output. As long as you have control over the device that the application you want to record uses then this option will always work.

所有这些技术都有各自的优点和缺点 - 它是由你来决定这将是最适合你的需求。

All of these techniques have their pros and cons - it's up to you to decide which would be the most suitable for your needs.

这篇关于如何捕获正在播放的音频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆