Today I worked more on a piece of code that should get up basic functionality of SenseStage/DataNetwork. With some nice help from Marije I’m now this far in SuperCollider:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
/////////////////////////////////////////////////////////////////////////// // DataNetwork host! ////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// ~datanet = SWDataNetwork.new; ~datanet.createHost; ~datanet.makeGui; /////////////////////////////////////////////////////////////////////////// // Nowsclang SETUP CONTROLLER MINIBEE to be able to listen to // the network of minibees- use python - pydon ( " echo "cd /home/random/src/pydonhive.8/pydon/" > /tmp/wonkohive.sh; echo "python swpydonhive.py -c wonko-hive.xml -s /dev/ttyUSB0" >> /tmp/wonkohive.sh; echo "sleep 10" >> /tmp/wonkohive.sh; chmod u+x /tmp/wonkohive.sh; gnome-terminal -t SW-WonkoHive -e /tmp/wonkohive.sh; sleep 2; rm /tmp/wonkohive.sh ".unixCmd; ) /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// // DataNetwork CLIENT! //////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// y = SWDataNetworkClient( "localhost", "NovaSC"); // create client y.subscribeNode(1); // subscribe to a DN node (a miniBee with accel. sensors) ~node1 = y.nodes[1]; ~node1.createBus(s); ~node1.value; // print what's on the bus ~node1.value.at(1); ~node1.value.at(2); ~node1.value.at(0); // define a synth ( SynthDef(ThreeWF, { |freq1=0.5, freq2=1, freq3=2, amp=0.05| Out.ar([0,1], SinOsc.ar(freq1 * 1000 - 300, 0, [amp,0]) + SinOsc.ar(freq2 * 1000 - 300, 0, [0,amp]) + SinOsc.ar(freq3 * 1000 - 300, 0, [amp,amp]) ); }).send(s) ) // instantiate the synth i = Synth(ThreeWF); // either we map a subBus to another variable ~node1bus1 = ~node1.bus.subBus(0,1); // .subBus (offset, numChannels = 1) // before we map it then to an argument of the synth i.map( freq1, ~node1bus1 ); // or we skip another variable all together i.map(freq2, ~node1.bus.subBus(1,1)); i.map(freq3, ~node1.bus.subBus(2,1)); /////////////////////////////////////////////////////////////////////////// |
I still have (more and more) questions. It’s funny, as you progress in slowly becoming familiar with language things keep on popping out, questions that are most of the time in the form of “why this doesn’t work? it should work, but it doesn’t!”
For example, if i write “~variable
” what exactly does it mean? It seems to be some kind of global variable, according to SC docs?