-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloader.py
More file actions
33 lines (23 loc) · 934 Bytes
/
loader.py
File metadata and controls
33 lines (23 loc) · 934 Bytes
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
import time
import os, sys
import subprocess
import OSC
class SCLoader(object):
def __init__(self):
self.process = None
def load(self):
path = os.path.dirname(sys.argv[0])
path = os.path.dirname(__file__)
os.system("/Applications/SuperCollider/sclang -d /Applications/SuperCollider/ " + path + '/synthdefs.sc')
os.system("/Applications/SuperCollider/sclang -d /Applications/SuperCollider/ " + path + '/ugensynthdefs.sc')
self.process = subprocess.Popen(["/Applications/SuperCollider/scsynth", "-u", "57110", '-a', '1024'], cwd="/Applications/SuperCollider")
time.sleep(2)
def stop(self):
self.process.terminate()
SECONDS_FROM_1900_TO_1970 = 2208988800
def sc_time():
return float(time.time()) + SECONDS_FROM_1900_TO_1970
sc_loader = SCLoader()
sc_loader.load()
client = OSC.OSCClient()
client.connect(('127.0.0.1', 57110))