本文整理汇总了Python中OSC.OSCMessage方法的典型用法代码示例。如果您正苦于以下问题:Python OSC.OSCMessage方法的具体用法?Python OSC.OSCMessage怎么用?Python OSC.OSCMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSC
的用法示例。
在下文中一共展示了OSC.OSCMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: freeze_playfile
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def freeze_playfile(self, new_file, dry_value=1., loop_status=True):
"""
default synth (freeze)
"""
# OSC Client (i.e. send OSC to SuperCollider)
osc_client = OSC.OSCClient()
osc_client.connect( ( self.sc_IP, self.sc_Port ) )
#TODO: write to $DATE_performance.log
print("\n\n***\n\t (sending OSC) Playing %s/%s\n\n"%(os.environ["PWD"],new_file))
msg = OSC.OSCMessage()
msg.setAddress("/playfreeze") # (file,voice_number)
msg.append( "%s/%s"%(os.environ["PWD"],new_file) )
msg.append( self.enabled_voice-1) #convert to [0..7] range
try:
osc_client.send(msg)
except Exception,e:
print(e)
#TODO: get duration from msg (via API)
# time.sleep(duration)
#()
#class
示例2: external_synth
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def external_synth(new_file):
"""
Sends OSC
Sends OSC to external synthesis engine like SuperCollider or pd
"""
print("\tPlaying %s"%new_file)
msg = OSC.OSCMessage()
msg.setAddress("/play")
#mac os #FIXME
msg.append( "/Users/hordia/Documents/apicultor"+new_file.split('.')[1]+'.wav' )
try:
osc_client.send(msg)
except Exception,e:
print(e)
#TODO: get duration from msg (via API)
time.sleep(duration)
#external_synth()
示例3: external_synth
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def external_synth(new_file):
"""
Sends OSC
Sends OSC to external synthesis engine like SuperCollider or pd
"""
print("\tPlaying %s"%new_file)
msg = OSC.OSCMessage()
msg.setAddress("/play")
#mac os #FIXME
msg.append( ""+new_file.split('.')[1]+'.wav' )
try:
osc_client.send(msg)
except Exception,e:
print(e)
#TODO: get duration from msg (via API)
time.sleep(duration)
#external_synth()
示例4: fade
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def fade(self,arrCmd):
oscm = OSCMessage("/live/track/fade")
oscm.append(self.int_or_string(arrCmd[0])) #track
oscm.append(float(arrCmd[1])) #final volume
if len(arrCmd) > 2:
oscm.append(arrCmd[2]) #bars, beats, or secs
if arrCmd[2].lower == 'bars' or arrCmd[2].lower == 'beats':
oscm.append(int(arrCmd[3])) #final volume
else:
oscm.append(float(arrCmd[3])) #final volume
if len(arrCmd) > 4:
oscm.append(int(arrCmd[4])) #increments
else:
oscm.append('bars') #bars, beats, or secs
oscm.append(1) #bars, beats, or secs
return oscm
示例5: deactivate
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def deactivate(self):
self.client.send(OSCMessage("/quit"))
# send channels values
示例6: __call__
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def __call__(self, sample):
mes = OSCMessage(self.address)
mes.append(sample.channel_data)
# silently pass if connection drops
try:
self.client.send(mes)
except:
return
示例7: send_message
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def send_message(self, point, event='drag', rest=0.012):
x, y = point
message = OSC.OSCMessage()
message.setAddress("/anoto")
message.append(x)
message.append(y)
message.append(event)
message.append(self.time)
self.time += (rest * 1000)
while self.time > 100:
self.time -= 100
self.c.send(message)
time.sleep(rest)
示例8: __build_msg
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def __build_msg(args):
msg = OSCMessage(args[0])
data = args[2]
msg.append(int(data[0]), typehint='i')
for d in data[1:]:
msg.append(float(d), typehint='f')
return msg
示例9: send_simple_message
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def send_simple_message(client, path, data=[], timeout=None):
# OSCClient, String, String, int -> None
msg = OSCMessage(path)
for d in data:
msg.append(d)
client.send(msg, timeout)
示例10: create_button_update_msg
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def create_button_update_msg(station, id, update):
msg = OSCMessage(button_path)
msg.append(station)
msg.append(id)
msg.append(update)
return msg
示例11: send_osc
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def send_osc(addr, *args):
msg = OSCMessage(addr)
for d in args:
msg.append(d)
return client.send(msg)
示例12: go
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def go(self):
if client_connected == True:
client.send( OSCMessage("/eos/key/go") )
return 1
else:
raise ValueError("Not connected")
return 0
示例13: stopback
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def stopback(self):
if client_connected==1:
client.send( OSCMessage("/eos/key/stop") )
return 1
else:
raise ValueError("Not connected")
return 0
示例14: chanlevel
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def chanlevel(self,channel,level):
if client_connected==1:
client.send( OSCMessage("/eos/chan/%s/at" % (channel), [level] ) )
return 1
else:
raise ValueError("Not connected")
return 0
示例15: cmdline
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCMessage [as 别名]
def cmdline(self,commandline):
if client_connected==1:
client.send( OSCMessage("/eos/cmd", [commandline] ) )
return 1
else:
raise ValueError("Not connected")
return 0