// title: Scgraph sound and vision part 2 // author: codepool // description: // Migration from the old SourceForge wiki. // code: /* Trying to get more concise style. First boot scgraph from the terminal: ./bin/scgraph then... */ // nonprivate after fredrik ( s = Server.local; s.boot; h = Server("scgraph", NetAddr("localhost", 37291)); h.boot; ) ////////////////////////// POINTS 1 ( SynthDef(\points, {|iFreq = 110, modFreq = 0.5, freqDeviation = 1, amp = 1, offset = 0.6| var src, ctrlSines, ctrlMul; ctrlMul = SinOsc.kr(modFreq * 0.7); ctrlSines = Array.newClear(6); ctrlSines.do { |item, index| ctrlSines[index] = SinOsc.kr(modFreq * 1.2 * (1 + (Rand(0, 0.5) * freqDeviation) ), 0, amp * 5); }; src = GPoints.gr( ctrlMul.range(2, 40), [ [ctrlSines[0], ctrlSines[1], 0], [ctrlSines[2], ctrlSines[3], 0], [ctrlSines[4], ctrlSines[5], 0] ] ); GGLRenderer.gr(src); }).send(h); SynthDef(\points, {|iFreq = 110, modFreq = 0.5, freqDeviation = 1, amp = 1, offset = 0.6| var src, audioSines, ctrlSines, ctrlMul; ctrlMul = SinOsc.kr(modFreq * 0.7); ctrlSines = Array.newClear(6); audioSines = Array.newClear(3); ctrlSines.do { |item, index| ctrlSines[index] = SinOsc.kr(modFreq * 1.2 * (1 + (Rand(0, 0.5) * freqDeviation) ), 0, amp * 4); }; audioSines.do { |item, index| audioSines[index] = SinOsc.ar( (iFreq * index) * ctrlSines[(index * 2) + 1], 0, amp * ctrlMul.range(0.051, 0.2) ); audioSines[index] = Pan2.ar(audioSines[index], ctrlSines[index * 2]); }; src = Mix.new(audioSines); Out.ar(0, src); }).send(s); ~start = { |iFreq = 110, modFreq = 0.5, freqDeviation = 1, amp = 1| ~scg = Array.newClear(2); [h, s].do { |item, index| ~scg[index] = Synth.new(\points, [\iFreq, iFreq, \modFreq, modFreq, \freqDeviation, freqDeviation, \amp, amp], target: item) }; }; ~setParams = { |iFreq = 110, modFreq = 0.5, freqDeviation = 1, amp = 1| ~scg.do { |item, index| item.set([\iFreq, iFreq, \modFreq, modFreq, \freqDeviation, freqDeviation, \amp, amp]); }; }; ~free = { ~scg.do { |item, index| item.free } }; ) ~start.value; ~setParams.value(80, 0.3, 2, 0.9); ~setParams.value(400, 0.8, 8, 0.3); ~setParams.value(297, 0.1, 2, 0.7); ~setParams.value(773, 0.8, 3, 0.7); ~free.value;