本文整理汇总了Python中OSC.OSCMessage.clear方法的典型用法代码示例。如果您正苦于以下问题:Python OSCMessage.clear方法的具体用法?Python OSCMessage.clear怎么用?Python OSCMessage.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSC.OSCMessage
的用法示例。
在下文中一共展示了OSCMessage.clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from OSC import OSCMessage [as 别名]
# 或者: from OSC.OSCMessage import clear [as 别名]
gevent.spawn(headset.setup)
gevent.sleep(0)
chanHist = [[0 for x in range(0)] for x in range(6)]
N = 128 #We always take 128 chunks so we get to slighly above 60hz
T = 1.0 / (N*1) # We know that the emotive delivers 128 samples persecond
count=0
try:
while True:
packet = headset.dequeue()
cCount=0
for k,v in packet.sensors.iteritems():
if ((k in SENSOR_LIST) and ('value' in v) and ('quality' in v)):
chanHist[cCount].append(v['value'])
cCount += 1
mOscMessage.clear("/emokit/"+k+"/")
mOscMessage.append(v['value'])
mOscMessage.append(v['quality'])
mOscClient.send(mOscMessage)
count += 1
if count >=N:
for i in range(0,len(chanHist)):
output=[1 for x in range(4)]
norm=[1 for x in range(4)]
yf = np.abs(scipy.fftpack.fft(chanHist[i]))
n = len(chanHist[i])
freq = np.fft.fftfreq(n, T)
xf = np.linspace(0.0, 1.0/(2.0*T), N/2)
j=2
while freq[j+1]>freq[j] :
if round(freq[j])>4 and round(freq[j])<7 :
示例2: OSCClient
# 需要导入模块: from OSC import OSCMessage [as 别名]
# 或者: from OSC.OSCMessage import clear [as 别名]
import gevent
OSC_OUT_HOST = "localhost"
OSC_OUT_PORT = 8444
SENSOR_LIST = 'AF3 F7 F3 FC5 T7 P7 O1 O2 P8 T8 FC6 F4 F8 AF4'
if __name__ == "__main__":
mOscClient = OSCClient()
mOscClient.connect( (OSC_OUT_HOST,OSC_OUT_PORT) )
mOscMessage = OSCMessage()
headset = Emotiv(serial_number="SN201405232628GM", vendor_id=8609, product_id=1)
gevent.spawn(headset.setup)
gevent.sleep(0)
try:
while True:
packet = headset.dequeue()
for k,v in packet.sensors.iteritems():
if ((k in SENSOR_LIST) and ('value' in v) and ('quality' in v)):
mOscMessage.clear("/emokit/"+k+"/")
mOscMessage.append(v['value'])
mOscMessage.append(v['quality'])
mOscClient.send(mOscMessage)
gevent.sleep(0)
except KeyboardInterrupt:
headset.close()
finally:
headset.close()