Skip to content

Instantly share code, notes, and snippets.

@tgck
Last active August 29, 2015 14:05
Show Gist options
  • Save tgck/c5104f9acbd65c6899e9 to your computer and use it in GitHub Desktop.
Save tgck/c5104f9acbd65c6899e9 to your computer and use it in GitHub Desktop.
oscsender.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# パイプから取り出した文字列を1行ずつ OSC送信 する
# $ ./keyEvent | ./oscsender.py
# 受信結果
# $ oscdump 1234
# /test s "/Users/tgck/Desktop/teddy"
# /test s "/Users/tgck/Desktop/AudioCycling"
# こういう文字列を受付
# /dump 3 KOROBBOKURU_2baisoku_ver_by_imai_from_group_inou.aif 239 426
import sys, liblo
try:
if(len(sys.argv) == 2):
target = liblo.Address(sys.argv[1])
else:
target = liblo.Address(8880)
except liblo.AddressError, err:
print str(err)
sys.exit()
for line in iter(sys.stdin.readline, ""):
arr = line.rstrip().split(' ')
liblo.send(target, arr[0], int(arr[1]), arr[2], int(arr[3]), int(arr[4]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment