Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: OceanTracker
name
code content
//this block evaluate first. Synth add and arrays initialize... ( ~ocean = Array.new(8); ~oceanz = Array.new(8); SynthDef.new(\ocean,{ var sig, mod; sig = BrownNoise.ar(0.15!2); mod = SinOsc.kr(0.2, 3pi/2).exprange(0.001,1); sig = sig * mod; sig = sig +(GVerb.ar(sig, 200,5) * 0.2); SendReply.kr(Impulse.kr(20), '/ocean', mod, 1); SendReply.kr(Impulse.kr(20), '/ocean2', sig, 1); Out.ar(0, sig); }).add; ) //the OSC defs to read the sendReplies and put them into the array. Evaluate this... ( OSCdef.new(\tracker,{ arg msg; //~ocean.postln; ~ocean.add( msg[3]); if(~ocean.size>=8,{ ~ocean.pop; }); ~ocean.addFirst(msg[3]); }, '/ocean'); OSCdef.new(\tracker2,{ arg msg; //~oceanz.postln; ~oceanz.add( msg[3]); if(~oceanz.size>=8,{ ~oceanz.pop; }); ~oceanz.addFirst(msg[3]); }, '/ocean2'); ) //start the synth. x = Synth(\ocean); //evaluate the GUI / metering. Shows 2 rows of metering one of the Sine wave as an envelope and the other the Noise as it is scaled. ( var indicators, indicators2, updateIndicators, updateIndicators2, test; // create window var window = Window.new("OceanData",360@420).front.onClose_({ updateIndicators.stop }); q = window.addFlowLayout; // add flowLayout // create and customize 8 Level indicators indicators = Array.fill(8, {LevelIndicator(window,40@200)}); q.nextLine; indicators2 = Array.fill(8, {LevelIndicator(window,40@200)}); indicators.do { arg item; item.warning_(0.8).critical_(0.9).background_(Color.green(0.4)).drawsPeak_(true); item.meterColor = Color.blue(0.9,0.4); }; indicators2.do { arg item; item.warning_(0.8).critical_(0.9).background_(Color.white(0.1,0.5)).drawsPeak_(true); }; // update the indicators with a routine updateIndicators = fork{loop{ indicators.do{ arg item, i; { var value = ~ocean[i]; // read value item.value_(value); item.peakLevel_(value); }.defer(); // schedule in the AppClock }; 0.1.wait; }}; updateIndicators2 = fork{loop{ indicators2.do{ arg item, i; { var value = ~oceanz[i]*5; item.value_(value); item.peakLevel_(value); }.defer(); // schedule in the AppClock }; 0.1.wait; }}; //get rid of everything at the same time. CmdPeriod.doOnce({ window.close }); window.onClose_({ x.free }); /*CmdPeriod.doOnce({ window.close }); window.onClose_({ CmdPeriod.run});*/ ) /*Fieldsteel's Synthdef used - with a couple of additions. Some of the metering modded from Koutsomichalis.*/
code description
Experiments in metering and mapping a synth using sendreply.kr and Level-Indicator.
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change