-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_pyo.py
70 lines (54 loc) · 1.99 KB
/
test_pyo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import sys, time
from pyo import *
if sys.platform == "win32":
host_apis = ["mme", "directsound", "asio", "wasapi", "wdm-ks"]
else:
print("This program must be used on a windows system! Ciao!")
exit()
print("* Checking for any available audio input... *")
input_names, input_indexes = pa_get_input_devices()
print("* Checking audio output hosts... *")
#(self, sr=44100, nchnls=2, buffersize=256, duplex=1, audio='portaudio',
#jackname='pyo', ichnls=None, winhost="wasapi", midi="portmidi"):
# s = Server(sr=48000, nchnls=1, buffersize=512, duplex=0)
s = Server(sr=48000, duplex=0)
s.verbosity = 0
host_results = []
for host in host_apis:
print("* Testing %s... *" % host)
try:
s.reinit(sr=48000, buffersize=1024, duplex=0, winhost=host)
s.boot().start()
a = Sine(freq=440, mul=0.2).out()
time.sleep(2)
s.stop()
s.shutdown()
host_results.append(True)
except:
host_results.append(False)
print("\nResults")
print("-------\n")
if len(input_names):
print("Duplex mode OK!")
print("Initialize the Server with duplex=1 as argument.\n")
else:
print("No input available. Duplex mode should be turned off.")
print("Initialize the Server with duplex=0 as argument.\n")
for i, host in enumerate(host_apis):
if host_results[i]:
print("Host: %s ==> OK!" % host)
else:
print("Host: %s ==> Failed..." % host)
print("Initialize the Server with the desired host given to winhost argument.")
print("\nFinished!")
# s = Server().boot()
# s.start()
# s.stop()
# s = Server(duplex=0).boot()
# wav = SquareTable()
# env = CosTable([(0,0), (100,1), (500,.3), (8191,0)])
# met = Metro(.125, 12).play()
# amp = TrigEnv(met, table=env, mul=.1)
# pit = TrigXnoiseMidi(met, dist='loopseg', x1=20, scale=1, mrange=(48,84))
# out = Osc(table=wav, freq=pit, mul=amp).out()
# sf = SfPlayer("sounds\\RNDYSVGE_frog_eyes.wav", speed=1, loop=True).out()