Last active
September 19, 2018 11:36
-
-
Save lisongx/f453a14093e92ce939165c6947f9a0cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I already start a osc-hub server in oschub.notimportant.org | |
// This is the oscdef to receive server commands, and evaluted on local server(just work like Tadashi's oschub) | |
( | |
var messages = [ | |
"/quit", "/notify", "/status", "/cmd", "/dumpOSC", "/sync", "/synced", | |
"/error", "/clearSched", | |
"/d_recv", "/d_load", "/d_loadDir", "/d_free", | |
"/n_free", "/n_run", "/n_set", "/n_setn", "/n_fill", "/n_map", "/n_mapn", | |
"/n_mapa", "/n_mapan", "/n_before", "/n_after", "/n_query", "/n_trace", | |
"/n_order", | |
"/s_new", "/s_get", "/s_getn", "/s_noid", | |
"/g_new", "/p_new", "/g_head", "/g_tail", "/g_freeAll", "/g_deepFree", | |
"/g_dumpTree", "/g_queryTree", | |
"/u_cmd", | |
"/b_alloc", "/b_allocRead", "/b_allocReadChannel", "/b_read", | |
"/b_readChannel", "/b_write", "/b_free", "/b_zero", "/b_set", "/b_setn", | |
"/b_fill", "/b_gen", "/b_close", "/b_query", "/b_get", "/b_getn", | |
"/c_set", "/c_setn", "/c_fill", "/c_get", "/c_getn", | |
"/nrt_end" | |
// "/done, "/fail", "/late", | |
// "/n_go", "/n_end", "/n_off", "/n_on", "/n_move", "/n_info", | |
// "/tr" | |
]; | |
messages.do {|path| | |
OSCdef.newMatching(\oschub ++ path , {|msg, time, addr, recvPort| | |
"osc commands received".postln; | |
msg.postln; | |
Server.local.listSendMsg(msg); | |
}, path); | |
}; | |
) | |
// start osc-hub client on my machine | |
// osc-hub -s 57120 -r 57123 -h oschub.notimportant.org | |
~oschub = Server.new(\OSCHub, NetAddr.new("localhost", 57123)) | |
// then I can do send synth and other thng to 57123,and it forwards back to my client because of the osc-hub | |
// not ideal, because here we have not using the osc message style for node creation and things... | |
SynthDef(\sean_sine2, {|freq=400, amp=0.2, pan=0, dur=10| | |
var env, envgen; | |
var sig = SinOsc.ar(freq, mul:amp); | |
env = Env.perc(attackTime: 0.05, releaseTime: 0.95); | |
sig = Pan2.ar(sig, pan); | |
envgen = EnvGen.kr(env, doneAction: Done.freeSelf, timeScale: dur); | |
Out.ar(0, sig*envgen); | |
}).doSend(~oschub); | |
~oschub.sendMsg("/s_new", \sean_sine3, s.nextNodeID, 0, 1, \freq, 500) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment