Domi
Domi

Reputation: 1

Microphone Input with Pyo Python

I'm currently creating a small Program with Python and pyo that should use the microphone input as a source and then add several effects and filters provided by pyo. I couldn't find anything in the docs, is there a way to use the microphone input as a source, are there any alternatives to pyo?

Here's the basic example I have so far:

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())

I know there's a function to set the input device, like s.setInputDevice(5), but I can not figure out how to actually use it.

Thanks for the help!

Upvotes: 0

Views: 1078

Answers (1)

robotic
robotic

Reputation: 51

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())

Upvotes: 1

Related Questions