python - 使用 Pyo Python 进行麦克风输入
问题描述
我目前正在使用 Python 和 pyo 创建一个小程序,它应该使用麦克风输入作为源,然后添加 pyo 提供的几个效果和过滤器。我在文档中找不到任何内容,有没有办法将麦克风输入用作源,是否有任何替代 pyo 的方法?
这是我到目前为止的基本示例:
from pyo import *
s = Server().boot()
s.start()
s.amp = 0.1
# use microphone input here
sf = Sig(1).out()
# Passes the sine wave through an harmonizer.
h1 = Harmonizer(sf).out()
s.gui(locals())
我知道有一个设置输入设备的功能,比如
s.setInputDevice(5)
,但我不知道如何实际使用它。
谢谢您的帮助!
解决方案
It looks like you aren't actually creating an input stream. Something like this (no gui) will output your microphone input:
from pyo import *
s = Server().boot()
s.start()
miccheck = Input().play().out()
Or, to modify the harmonizer default example:
from pyo import *
s = Server().boot()
mic = Input().play().out()
env = WinTable(8)
wsize = .1
trans = -7
ratio = pow(2., trans/12.)
rate = -(ratio-1) / wsize
ind = Phasor(freq=rate, phase=[0,0.5])
win = Pointer(table=env, index=ind, mul=.7)
snd = Delay(mic, delay=ind*wsize, mul=win).mix(1).out(1)
s.gui(locals())
推荐阅读
- c++ - 具有不同底层 STL 容器的两个类如何呈现相同的迭代器接口?
- batch-file - 为什么这段代码不显示我设置的 5 个随机标题?
- redux - getStaticProps 在 prod 和 dev 处返回空对象(下一个 v9.5.1)
- python - 如何刷新/重新启动画布以在 Tkinter 中创建不同的绘图?
- php - Laravel 不允许序列化“闭包”
- ios - SSL pinning 与 AFNetworking 崩溃问题
- python - 如何在 Heroku 中运行 Docker 容器
- pytorch - DDPG 中的保单损失
- ios - 无法使用 xib 将背景视图添加到弹出视图下
- xml - 使用 groovy 脚本或 xslt 合并两个 xml