如何让python检测来自应用程序的音频? [英] How to make python detect audio from an application?

查看:51
本文介绍了如何让python检测来自应用程序的音频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一些在从 Windows 应用程序检测到音频时运行的东西.有什么办法可以使用 python 做到这一点.

I'm trying to make something that runs when audio is detected from a windows application. Is there any way to do this using python.

我在 python 2.7.12 上运行,但我愿意在必要时进行更新.我也可以检测到任何来自计算机的声音.

I'm running on python 2.7.12 but I'm willing to update if necessary. I'm also fine with detecting any sound at all coming from the computer.

非常感谢.

推荐答案

看看 http://python-sounddevice.readthedocs.io/en/0.3.4/#sounddevice.RawInputStream您可以使用它来检测进出计算机声卡的音频.

take a look at http://python-sounddevice.readthedocs.io/en/0.3.4/#sounddevice.RawInputStream You could use this to detect audio to and from the sound card of the computer.

特定类是从麦克风获取声音的一种方式.

The particular class is one way to get sound from a mic.

来自声音设备库

class sounddevice.RawInputStream(samplerate=None,blocksize=None,device=None,channel=None,dtype=None,latency=None,callback=None,finished_callback=None,clip_off=None,dither_off=None,never_drop_input=无,prime_output_buffers_using_stream_callback=None)

class sounddevice.RawInputStream(samplerate=None, blocksize=None, device=None, channels=None, dtype=None, latency=None, callback=None, finished_callback=None, clip_off=None, dither_off=None, never_drop_input=None, prime_output_buffers_using_stream_callback=None)

或者您可以过滤声卡的输出以了解何时发送音频信号.

or you could filter the output of the sound card to know when audio signal is being sent.

class sounddevice.OutputStream(samplerate=None,blocksize=None,device=None,channels=None,dtype=None,latency=None,callback=None,finished_callback=None,clip_off=None,dither_off=None,never_drop_input=无,prime_output_buffers_using_stream_callback=None)

class sounddevice.OutputStream(samplerate=None, blocksize=None, device=None, channels=None, dtype=None, latency=None, callback=None, finished_callback=None, clip_off=None, dither_off=None, never_drop_input=None, prime_output_buffers_using_stream_callback=None)

这篇关于如何让python检测来自应用程序的音频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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