我正在尝试使用来自 neuroPy 的变量 (1-13) 向 Supercollider 发送多个OSC消息。它只适用于一个变量。我怎样才能利用更多的变量。
from NeuroPy import NeuroPy
import time
import OSC
port = 57120
sc = OSC.OSCClient()
sc.connect(('192.168.1.4', port)) #send locally to laptop
object1 = NeuroPy("/dev/rfcomm0")
zero = 0
variable1 = object1.attention
variable2 = object1.meditation
variable3 = object1.rawValue
variable4 = object1.delta
variable5 = object1.theta
variable6 = object1.lowAlpha
variable7 = object1.highAlpha
variable8 = object1.lowBeta
variable9 = object1.highBeta
variable10 = object1.lowGamma
variable11 = object1.midGamma
variable12 = object1.poorSignal
variable13 = object1.blinkStrength
time.sleep(5)
object1.start()
def sendOSC(name, val):
msg = OSC.OSCMessage()
msg.setAddress(name)
msg.append(val)
try:
sc.send(msg)
except:
pass
print msg #debug
while True:
val = variable1
if val!=zero:
time.sleep(2)
sendOSC("/att", val)
这工作正常,我按预期在 Supercollider 中收到消息。
我可以做些什么来添加更多变量并获取更多消息?
我认为它应该与 setCallBack 相关。